Repository navigation
fix: user-info lookups leave out client headers that break them - #147
Conversation
Signed-off-by: Oleksandr Piskun <oleksandr2088@icloud.com>
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ 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:
976366b5-cb77-46cd-9d73-14ae925e1170
📒 Files selected for processing: 3
.github/workflows/tests-deploy-docker.ymlhaproxy_agent.pytests/unit/test_requests.py
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
The user-info lookup the agent sends to Nextcloud is a GET without a body, but it copies the client's headers onto it,
Transfer-Encoding: chunkedincluded. A streaming upload with credentials (curl -T -, a Python generator, a Node or Go stream body) then leaves Nextcloud's web server waiting for a body that never comes. When Nextcloud is served through nginx or AIO's Apache, the request fails with 401 after 25 seconds. With Apache and mod_php (the officialnextcloud:apacheimage) it succeeds, but only after 10 seconds. An Apache reverse proxy in front of Nextcloud answers the lookup with 408 after 20 seconds, so the client gets 403 and HaRP records a failed attempt.This happens on user, admin and public routes whenever the request carries an
Authorizationheader or a session cookie and reaches HaRP chunked, directly or through a front proxy that passes chunked requests on (Caddy, Traefik, HAProxy, AIO, Apache forcurl -T -and larger bodies, nginx withproxy_request_buffering off).A
Rangeheader is copied as well, and Apache applies it to the lookup's answer, so a resumed download or a media seek with credentials gets 401, or 403 with a recorded failed attempt.Changes
Transfer-Encoding,Connection,Keep-Alive,Proxy-Connection,Upgrade,TE,Trailer),Expect,Rangeand everyContent-*header.Proxy-AuthorizationandProxy-Authenticate, andAccept-Encoding, so Nextcloud is only offered encodings the agent can decode (browsers also offer zstd).The request HaRP forwards to the ExApp is unchanged.