fix(feeds): self link uses configured domain, not request host

The RSS/Atom/JSON self link was derived from the request origin, leaking
the workers.dev host when reached directly instead of via the custom
domain. Use the configured-domain URL builders so self matches alternate.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Julien Herr
2026-05-25 18:38:38 +02:00
parent cbf6bb7e7e
commit 1332362005
6 changed files with 14 additions and 8 deletions
+4 -2
View File
@@ -117,10 +117,12 @@ describe("Atom Feed Route", () => {
expect(body).toContain("Atom Test Feed");
});
it("self-link points to atom URL", async () => {
it("self-link uses the configured domain, not the request host", async () => {
const res = await testApp.request(`/${FEED_ID}`, {}, mockEnv);
const body = await res.text();
expect(body).toContain(`/atom/${FEED_ID}`);
expect(body).toContain(
`rel="self" href="https://${mockEnv.DOMAIN}/atom/${FEED_ID}"`,
);
});
it("Link header advertises hub and self for WebSub discovery", async () => {