Skip to content

fix(proxy): answer HEAD on the HLS master playlist - #4462

Merged
Quick104 merged 2 commits into
mainfrom
fix/proxy-hls-master-playlist-head
Nov 18, 2026
Merged

Quick104 merged 2 commits into
mainfrom
fix/proxy-hls-master-playlist-head

Conversation

@Quick104

@Quick104 Quick104 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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.m3u8 and /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.m3u8 on 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-Length included, 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.md that recorded the 405 now describes the new behavior.

Validation

  • Root cause: the real node router, called with a signed request on main, answers HEAD on the playlist path with 405 and Allow: GET.
  • The proxy streaming protocol test sends a real HEAD through the proxy router to a fake node. It now requires the node to receive GET and the client to get the node's status, headers and declared Content-Length with 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 gate: build, gofmt, go mod tidy -diff, vet, make lint-changed and make lint-router-recovery are clean. go test ./... passes except TestCopyRemuxSubtitleRenditionRealFFmpeg (seek subtests), which fails the same way on main with the test host's FFmpeg 6.1.
  • Not reproduced live. A sandbox with proxy and transcode nodes can't run a transcode node from current main: the sandbox tooling hasn't caught up with feat(nodes): run transcode nodes without database, Redis or shared secrets #4337, which changed how a node gets its configuration.
  • The validation board check could not run (no project read access from the test host). Proxy playlist HEAD returned 405 before this change, so no passed case can depend on it.

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

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or how I checked a change nobody sees.

AI Disclosure

  • Harness: Claude Code (Claude Agent SDK) in T3 Code
  • Tool(s): Claude Code; Codex CLI (background review only)
  • Model(s): claude-opus-5-5; gpt-6.2-sol (background review)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: single-pass code review at low effort, which found the stale protocol doc paragraph (fixed). The plan round was skipped as a mechanical fix: the root cause is shown in the source and the production change is a few lines at the boundary fix(playback): answer HEAD on the v2 HLS playlist #4459 already chose. A simplify pass reformatted the test table. A background adversarial review (gpt-6.2-sol, reviewed e609e27) found two issues, both fixed in 2919977: the proxy read and metered the node's body for a HEAD, so a node that dropped mid-body aborted the reply; and the protocol doc overstated what the API relay keeps.

🤖 Generated with Claude Code

Note

Fix HEAD handling for HLS master playlist in proxy relay

  • The proxyToTranscodeNode relay handler now sends GET to the transcode node when the client's HEAD request path ends in master.m3u8 (server.go)
  • For any client HEAD request, the proxy copies the node's status and headers (including Content-Length) but returns no body. It also skips the segment-completion acknowledgment path for HEAD
  • Updates the protocol doc in worker-http-protocol.md and extends tests to assert the upstream method and empty HEAD response
  • Behavioral Change: all client HEAD responses no longer include a body, and manifest HEAD is now upstream GET; segment routes still accept GET only and remux HEAD is still forwarded as HEAD

Macroscope summarized 2919977.

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>
@silo-triage silo-triage Bot added the size/S 0–49 added + deleted lines (all files); change volume, not priority. label Nov 18, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T01:05:13.000382Z 2919977 New commits
🔒 Security Review ✅ Completed 2026-11-18T01:08:00.709661Z 2919977 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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

silo-kody Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The proxy now sends GET upstream for HEAD requests to master playlists. Other request methods remain unchanged. Tests verify the upstream method and confirm that the downstream HEAD response has no body and retains a Content-Length of 14. The protocol documentation describes the relay behavior.

Changes: Master playlist HEAD handling

Layer / File(s) Summary
Proxy method conversion and response verification
internal/proxy/server.go, internal/proxy/streaming_protocol_test.go, docs/architecture/worker-http-protocol.md
The proxy uses GET upstream for HEAD requests to master playlists and retains the incoming method for other requests. Tests check the upstream method and the empty downstream HEAD body with Content-Length 14. The documentation describes the relay behavior and distinguishes segment and remux HEAD handling.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: blurbery, rhainland

Merge Risk: Minimal · up to e609e

Master playlist HEAD requests through the proxy now succeed instead of returning 405 from the node. Other request methods are unchanged, and tests and documentation cover the new behavior. No merge-blocking risk was found.

Security architecture risk: Minimal · up to e609e

The change restores playlist HEAD responses without changing who may access streams. It reuses existing authorized request and recovery behavior; no introduced security or failure-containment risk was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The additional execution is confined to the existing manifest GET behavior for callers already authorized to use those stream routes. Such callers could already invoke GET to refresh or reconstruct the same session; the diff does not establish broader account, media, or worker authority.

Trust Boundaries and Controls

  • observed — Authorization precedes method adaptation. Token routes verify the stream token, egress binding, deny state, and endpoint family. Grant routes validate an access JWT and live login session, require a same-user stored grant, enforce the remote-playback profile restriction where applicable, and check deny state and routing authority.
  • observed — The node requires a signature verified with its node key before serving the manifest. Live HLS sessions rely on the relay's preceding authorization and deny checks. Missing sessions instead request core resolution for the transport and forwarded token; that resolution validates token/transport identity, checks deny state, selects recipe authority, and invokes the node-binding check before granting the source.

Resilience and Maintainability Implications

  • observed — The reused reconstruction path coalesces concurrent requests by session, rechecks existing sessions under lifecycle exclusion, checks stop fences, excludes reload and shutdown transitions, and limits concurrent cold starts. Before registration, failure paths close the opened source; successful registration transfers ownership to the session. Stop, idle reap, source withdrawal, and shutdown remove owned session state and close resources.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(proxy): answer HEAD on the HLS master playlist" matches the main change: the proxy now asks the transcode node with GET when a client sends HEAD for a master playlist, so the node's 405…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states the problem (HEAD on the HLS master playlist returns 405 from the transcode node), the approach (proxy asks the node with GET and relays status and headers without the body), th…
Full details: Title check

Explanation

The title "fix(proxy): answer HEAD on the HLS master playlist" matches the main change: the proxy now asks the transcode node with GET when a client sends HEAD for a master playlist, so the node's 405 is no longer relayed. The title is specific, short, and in a conventional commit form.

Full details: Description check

Explanation

The description states the problem (HEAD on the HLS master playlist returns 405 from the transcode node), the approach (proxy asks the node with GET and relays status and headers without the body), the validation steps, and the risks. It is directly related to the changeset in internal/proxy/server.go, the streaming protocol test, and the protocol doc.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 62e3fe1b-b9f8-4e68-8a23-e1e03fb9c100
Commits

Reviewing files that changed from the base of the PR and between 951a018 and e609e27.

Files selected for processing: 3

  • docs/architecture/worker-http-protocol.md
  • internal/proxy/server.go
  • internal/proxy/streaming_protocol_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish labels Nov 18, 2026

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review (gpt-6.2-sol, reviewed e609e27)

The comments cover the manifest HEAD response and the worker protocol description.

AI disclosure: Reviewed with Codex CLI using gpt-6.2-sol.

Comment thread internal/proxy/server.go Resolved
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

silo-kody Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104
Quick104 merged commit a1515ba into main Nov 18, 2026
21 checks passed
@Quick104
Quick104 deleted the fix/proxy-hls-master-playlist-head branch November 18, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish size/S 0–49 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant