Repository navigation
fix(proxy): answer HEAD on the HLS master playlist - #4462
Merged
Merged
Conversation
The transcode node serves the master playlist on GET only, and the proxy relayed a client's HEAD as HEAD, so the node's 405 reached the client. A DLNA controller checks a stream URL with HEAD before handing it to a TV, so a cast whose plan used proxy egress failed there. The proxy now asks the node with GET for a HEAD on the playlist, as the API relay already does. net/http drops the body and keeps the node's status and headers, Content-Length included. Segment routes take GET only, and remux HEAD still reaches the node as HEAD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Contributor
Quick104
commented
Nov 18, 2026
A manifest HEAD asks the node with GET, and the relay then copied the playlist into a reply net/http discards. A node that dropped mid-body aborted the HEAD, and the egress meter counted bytes nobody received. The relay now returns once the status and headers are written. The protocol doc no longer says the API relay keeps the node's headers: it rewrites a re-tokenized playlist and recomputes its Content-Length. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A (found in review of #4459)
Validation tasks: none
Other clients: N/A (no client-visible change; Apple, Android, Roku and Web load the playlist with GET)
A HEAD request on a standalone proxy's HLS master playlist gets
405 Method Not Allowed. The proxy accepts HEAD on/stream/transcode/{token}/master.m3u8and/stream/v3/{session_id}/master.m3u8, but it relays the request to the transcode node with the client's method, and the node serves/transcode/{session_id}/master.m3u8on GET only. The proxy passes the node's 405 through. A DLNA controller checks a stream URL with HEAD before it hands it to a TV, so a cast whose plan uses proxy egress fails at that check. #4459 fixed the same failure for the playlist the API serves.Approach
For a HEAD on the master playlist, the proxy now asks the node with GET and answers with the node's status and headers,
Content-Lengthincluded, without reading the body. The API's own relay to a node already sends GET.The other option was to register HEAD on the node. That would also need a node upgrade before a proxy HEAD worked, and it gives no benefit here: the node builds the same playlist for either method. Segment routes on the proxy take GET only, and a remux HEAD still reaches the node as HEAD, which the node answers without starting a remux. The paragraph in
docs/architecture/worker-http-protocol.mdthat recorded the 405 now describes the new behavior.Validation
405andAllow: GET.Content-Lengthwith no body, even when the node drops the connection partway through the body. On main it fails with "node asked with HEAD, want GET"; on this branch it passes.go mod tidy -diff, vet,make lint-changedandmake lint-router-recoveryare clean.go test ./...passes exceptTestCopyRemuxSubtitleRenditionRealFFmpeg(seek subtests), which fails the same way on main with the test host's FFmpeg 6.1.Evidence: https://evidence.siloserver.org/r/silo-server/proxy-hls-master-head/
Risks
A HEAD on the playlist now does the same node work as a GET: it refreshes the session and can rebuild a session the node lost, as a GET would. Nothing changes for GET.
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Fix HEAD handling for HLS master playlist in proxy relay
proxyToTranscodeNoderelay handler now sends GET to the transcode node when the client's HEAD request path ends inmaster.m3u8(server.go)Macroscope summarized 2919977.