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 <noreply@anthropic.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user