From f275fdef67ffd262ad7cf5e8fe62fc5a1cb91124 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 18 Mar 2026 10:28:49 +0100 Subject: [PATCH] fix(webmention-sender): drop internal URL rewriting, fetch public URL directly The public URL (blog.giersig.eu) is reachable from inside the jail, so the INTERNAL_FETCH_URL rewriting approach was unnecessary and caused 400/502 errors because 10.100.0.10 does not serve the static blog pages. Simplify the livefetch patch to fetch postUrl directly. Co-Authored-By: Claude Sonnet 4.6 --- scripts/patch-webmention-sender-livefetch.mjs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/scripts/patch-webmention-sender-livefetch.mjs b/scripts/patch-webmention-sender-livefetch.mjs index 7839519d..e183f49e 100644 --- a/scripts/patch-webmention-sender-livefetch.mjs +++ b/scripts/patch-webmention-sender-livefetch.mjs @@ -40,28 +40,16 @@ const originalBlock = ` // If no content, try fetching the published page const newBlock = ` // [patched:livefetch] Always fetch the live page so template-rendered links // (u-in-reply-to, u-like-of, u-bookmark-of, u-repost-of, etc.) are included. // Stored content only has the post body, not these microformat links. - // Rewrite public URL to localhost for jailed setups where the server - // can't reach its own public HTTPS URL. let contentToProcess = ""; try { - const _internalBase = (() => { - if (process.env.INTERNAL_FETCH_URL) return process.env.INTERNAL_FETCH_URL.replace(/\\/+$/, ""); - const port = process.env.PORT || "3000"; - return \`http://localhost:\${port}\`; - })(); - const _publicBase = (process.env.PUBLICATION_URL || process.env.SITE_URL || siteUrl || "").replace(/\\/+$/, ""); - const fetchUrl = (_publicBase && postUrl.startsWith(_publicBase)) - ? _internalBase + postUrl.slice(_publicBase.length) - : postUrl; const _ac = new AbortController(); const _timeout = setTimeout(() => _ac.abort(), 15000); - const _fetchHost = new URL(postUrl).host; - const pageResponse = await fetch(fetchUrl, { signal: _ac.signal, headers: { "Host": _fetchHost } }); + const pageResponse = await fetch(postUrl, { signal: _ac.signal }); clearTimeout(_timeout); if (pageResponse.ok) { contentToProcess = await pageResponse.text(); } else { - console.log(\`[webmention] Live page returned \${pageResponse.status} for \${fetchUrl}\`); + console.log(\`[webmention] Live page returned \${pageResponse.status} for \${postUrl}\`); } } catch (error) { console.log(\`[webmention] Could not fetch live page for \${postUrl}: \${error.message}\`);