From cb8629779117443cc26ff07953139170b2960f4a Mon Sep 17 00:00:00 2001 From: dktsudgg Date: Tue, 28 Jul 2026 03:52:56 +0900 Subject: [PATCH 1/7] Avoid duplicate response headers on Elysia 1.4.18 and earlier When a response has a body, the plugin returns the `response` object directly, so there is no need to copy the response's headers into Elysia's `set.headers`. Elysia already includes `response.headers` in the HTTP response on its own. In fact, on Elysia 1.4.18 and earlier, copying `response.headers` into `set.headers` and then returning the response causes the HTTP response headers to be duplicated. (This was fixed on Elysia's side in 1.4.19.) This change therefore moves the early return of the `response` object, for the case where a body exists, above the header copy so that the HTTP response headers are no longer duplicated. While this problem is partly due to the bug in Elysia 1.4.18 and earlier, this fix is expected to resolve it sufficiently, so it does not raise the project's minimum Elysia version, keeping the current Elysia version support range intact. Assisted-by: Claude Code:claude-fable-5 --- packages/elysia/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/elysia/src/index.ts b/packages/elysia/src/index.ts index 8a1648abb..9381d0d13 100644 --- a/packages/elysia/src/index.ts +++ b/packages/elysia/src/index.ts @@ -42,15 +42,15 @@ export const fedify = ( if (!notFound && !notAcceptable) { set.status = response.status; - response.headers.forEach((value, key) => { - set.headers[key] = value; - }); - // Return response body if it exists if (response.body) { return response; } + response.headers.forEach((value, key) => { + set.headers[key] = value; + }); + // Return empty response for successful requests without body return new Response(null, { status: response.status }); } From 694e2e6c1ebaf778d56422cf8a0f9126ee8da3f1 Mon Sep 17 00:00:00 2001 From: dktsudgg Date: Sun, 9 Aug 2026 11:18:39 +0900 Subject: [PATCH 2/7] Add changelog entry for the Elysia duplicate header fix Assisted-by: Claude Code:claude-fable-5 --- changes.d/elysia/duplicate-response-headers.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changes.d/elysia/duplicate-response-headers.md diff --git a/changes.d/elysia/duplicate-response-headers.md b/changes.d/elysia/duplicate-response-headers.md new file mode 100644 index 000000000..5e784dc80 --- /dev/null +++ b/changes.d/elysia/duplicate-response-headers.md @@ -0,0 +1,4 @@ + - Fixed duplicate response headers on Elysia 1.4.18 and earlier, which + append both `set.headers` and the returned `Response`'s own headers + without deduplication. The `fedify()` plugin no longer sets the headers + in both places. [[#970], [#972] by dktsudgg] From 40ded42e291b1abe019e0086f96d6d53a12ab1da Mon Sep 17 00:00:00 2001 From: dktsudgg Date: Fri, 14 Aug 2026 17:30:19 +0900 Subject: [PATCH 3/7] Use real name in the changelog --- CHANGES.md | 10 ++++++++++ changes.d/elysia/duplicate-response-headers.md | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 8964d5f04..61ebf043d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,16 @@ Version 2.0.25 To be released. +### @fedify/elysia + + - Fixed duplicate response headers on Elysia 1.4.18 and earlier, which + append both `set.headers` and the returned `Response`'s own headers + without deduplication. The `fedify()` plugin no longer sets the headers + in both places. [[#970], [#972] by dktsudgg\] + +[#970]: https://github.com/fedify-dev/fedify/issues/970 +[#972]: https://github.com/fedify-dev/fedify/issues/972 + Version 2.0.24 -------------- diff --git a/changes.d/elysia/duplicate-response-headers.md b/changes.d/elysia/duplicate-response-headers.md index 5e784dc80..19f7c5066 100644 --- a/changes.d/elysia/duplicate-response-headers.md +++ b/changes.d/elysia/duplicate-response-headers.md @@ -1,4 +1,4 @@ - Fixed duplicate response headers on Elysia 1.4.18 and earlier, which append both `set.headers` and the returned `Response`'s own headers without deduplication. The `fedify()` plugin no longer sets the headers - in both places. [[#970], [#972] by dktsudgg] + in both places. [[#970], [#972] by Kyujin Lim] From 655f2dc5ffd8d1e33c7e00384a67b9f06bcb35d3 Mon Sep 17 00:00:00 2001 From: dktsudgg Date: Sat, 15 Aug 2026 00:41:12 +0900 Subject: [PATCH 4/7] Fix wrong information --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 61ebf043d..d25126122 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,7 +16,7 @@ To be released. in both places. [[#970], [#972] by dktsudgg\] [#970]: https://github.com/fedify-dev/fedify/issues/970 -[#972]: https://github.com/fedify-dev/fedify/issues/972 +[#972]: https://github.com/fedify-dev/fedify/pull/972 Version 2.0.24 From 2ab6c5f189be6246eba7a154f1a49a9c158db2ca Mon Sep 17 00:00:00 2001 From: dktsudgg Date: Sat, 15 Aug 2026 00:53:23 +0900 Subject: [PATCH 5/7] Use real name in the changelog --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index d25126122..ef4be9245 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,7 +13,7 @@ To be released. - Fixed duplicate response headers on Elysia 1.4.18 and earlier, which append both `set.headers` and the returned `Response`'s own headers without deduplication. The `fedify()` plugin no longer sets the headers - in both places. [[#970], [#972] by dktsudgg\] + in both places. [[#970], [#972] by Kyujin Lim\] [#970]: https://github.com/fedify-dev/fedify/issues/970 [#972]: https://github.com/fedify-dev/fedify/pull/972 From e23375094191946f6b165e0d1ba5a4dd202427ce Mon Sep 17 00:00:00 2001 From: dktsudgg Date: Sat, 15 Aug 2026 01:08:53 +0900 Subject: [PATCH 6/7] Declare link URLs in the changelog fragment CHANGES.md links the `#972` reference to the pull request URL, but the fragment declared no link URLs, so sacho compiled its default issue URL and `sacho check` reported the materialized changelog as out of sync. Add a front matter links block so the compiled entry matches CHANGES.md. Assisted-by: Claude Code:claude-fable-5 --- changes.d/elysia/duplicate-response-headers.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/changes.d/elysia/duplicate-response-headers.md b/changes.d/elysia/duplicate-response-headers.md index 19f7c5066..a913ba37e 100644 --- a/changes.d/elysia/duplicate-response-headers.md +++ b/changes.d/elysia/duplicate-response-headers.md @@ -1,3 +1,8 @@ +--- +links: + '#970': https://github.com/fedify-dev/fedify/issues/970 + '#972': https://github.com/fedify-dev/fedify/pull/972 +--- - Fixed duplicate response headers on Elysia 1.4.18 and earlier, which append both `set.headers` and the returned `Response`'s own headers without deduplication. The `fedify()` plugin no longer sets the headers From 9cc1d9e2c137ba0c27bbc1c4bc183b2f8c27d533 Mon Sep 17 00:00:00 2001 From: dktsudgg Date: Sat, 15 Aug 2026 01:10:27 +0900 Subject: [PATCH 7/7] Exclude changelog fragments from Hongdown Hongdown 0.5.3 requires a blank line after the front matter closing delimiter while sacho's normal form forbids one, so a fragment with a links block cannot satisfy both checkers. Exclude changes.d/ from Hongdown as main already does, leaving the fragments to sacho alone. Assisted-by: Claude Code:claude-fable-5 --- .hongdown.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/.hongdown.toml b/.hongdown.toml index fa850b8b0..a2acc0c0c 100644 --- a/.hongdown.toml +++ b/.hongdown.toml @@ -7,6 +7,7 @@ exclude = [ ".github/copilot-instructions.md", "AGENT.md", "CLAUDE.md", + "changes.d/**", "GEMINI.md", "WARP.md", "packages/fedify/src/cfworkers/**",