Skip to content

fix: send browser request headers to puller so hotlinked streams work#16

Merged
stupside merged 3 commits into
mainfrom
14-getting-403-with-1embed-exemple
Jul 19, 2026
Merged

fix: send browser request headers to puller so hotlinked streams work#16
stupside merged 3 commits into
mainfrom
14-getting-403-with-1embed-exemple

Conversation

@stupside

Copy link
Copy Markdown
Owner

MIME-detected streams (e.g. 1embed.cc/api/proxy) were fetched with the Cloudflare response headers instead of request headers: the response event's RequestHeaders come back empty, and the old fallback substituted the response's own headers. Those carry no Referer, so proxy/CDN hosts that enforce hotlink protection returned 403 on every probe and pull.

Record the real outgoing headers from requestWillBeSent (Referer, User-Agent, sec-ch-*) by request ID and hand them to the response handler, so a stream confirmed by MIME is fetched with the same headers the browser used.

Fixes #14

MIME-detected streams (e.g. 1embed.cc/api/proxy) were fetched with the
Cloudflare response headers instead of request headers: the response
event's RequestHeaders come back empty, and the old fallback substituted
the response's own headers. Those carry no Referer, so proxy/CDN hosts
that enforce hotlink protection returned 403 on every probe and pull.

Record the real outgoing headers from requestWillBeSent (Referer,
User-Agent, sec-ch-*) by request ID and hand them to the response
handler, so a stream confirmed by MIME is fetched with the same headers
the browser used.

Fixes #14
@stupside stupside linked an issue Jul 19, 2026 that may be closed by this pull request
stupside added 2 commits July 19, 2026 13:25
A stream URL logged to console is captured with nil headers; if that
sighting lands before the browser's actual network request for the same
URL, dedup kept the header-less version and dropped the real Referer/
User-Agent. Upgrade a captured candidate's headers when a later network
sighting carries them and the stored ones were empty, so hotlink-
protected hosts always get the headers the browser sent.
The extension-relaxing flags (-allowed_segment_extensions,
-seg_format_options, ...) are options on the HLS demuxer. Passing them
for a plain-file input like MP4 makes ffmpeg abort with 'Option not
found' (ffprobe tolerates them, which is why probing an MP4 succeeded
while the pull died). Thread the source content type into the puller and
network encoder and select the input flags by container, so a direct MP4
is fetched without HLS-specific options.
@stupside
stupside merged commit 5651dd9 into main Jul 19, 2026
4 checks passed
@stupside
stupside deleted the 14-getting-403-with-1embed-exemple branch July 19, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Getting 403 errors

1 participant