From b52266219958bdc58b03513f202b2c37e50f29f6 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 18 Mar 2026 10:02:12 +0100 Subject: [PATCH] fix(webmention-sender): send Host header when fetching via internal URL When rewriting the public URL to INTERNAL_FETCH_URL for jailed setups, the Host header becomes the internal IP (e.g. 10.100.0.10) instead of the public hostname (blog.giersig.eu). nginx uses the Host header for virtual host routing and returns 400 without the correct value. Fix: extract the host from the original public postUrl and set it as the Host header on the internal fetch, so nginx routes to the correct vhost. Co-Authored-By: Claude Sonnet 4.6 --- scripts/patch-webmention-sender-livefetch.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/patch-webmention-sender-livefetch.mjs b/scripts/patch-webmention-sender-livefetch.mjs index 38508127..7839519d 100644 --- a/scripts/patch-webmention-sender-livefetch.mjs +++ b/scripts/patch-webmention-sender-livefetch.mjs @@ -55,7 +55,8 @@ const newBlock = ` // [patched:livefetch] Always fetch the live page so t : postUrl; const _ac = new AbortController(); const _timeout = setTimeout(() => _ac.abort(), 15000); - const pageResponse = await fetch(fetchUrl, { signal: _ac.signal }); + const _fetchHost = new URL(postUrl).host; + const pageResponse = await fetch(fetchUrl, { signal: _ac.signal, headers: { "Host": _fetchHost } }); clearTimeout(_timeout); if (pageResponse.ok) { contentToProcess = await pageResponse.text();