[BUG] User-Agent Response Header Being Stripped Out
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
- Set up an HTTP server that responds with a "User-Agent" header.
- Point to this HTTP server as a destination
- Open Inspect Element and go to the "Network" tab
- Connect through the proxy with the host name needed to forward to that HTTP server
- Under Response Headers, notice that the "User-Agent" header has been stripped
Expected behavior The "User-Agent" header should not be arbitrarily stripped out of the response headers without some setting to turn such behavior off. This breaks webapps like Pelican that use this header to communicate between a frontend webserver and a backend webserver.
Screenshots Response headers when navigating to my proxy with a hostname that proxies me to a webserver that responds with a "User-Agent" header
Response headers when navigating directly to the backend/upstream webserver that sits behind the proxy
Browser (Not relevant but in case you end up needing it):
- OS: Fedora Linux 42
- Browser Brave
- Version Brave 1.84.139 Chromium 142.0.7444.163
Host Environment (please complete following information, DO NOT REMOVE ANY FIELD(S)):
- Arch: arm64
- Device: HP Proliant Gen8 Server
- OS: TrueNAS
- Version 24.10.2.2
- Are you using Docker? yes
- Docker Version (fill in "N/A" for native deployment): N/A (this is using the TrueNAS app)
Additional context Since I'm using the TrueNAS app, which I'm not sure is officially supported, if this is somehow the packagers fault with the people who make the "App" for TrueNAS, I would appreciate being given where I'm supposed to communicate with them.
Hey @MegaTophat
The User-Agent header is for downstream (e.g. web browser) to indicate who they are to the upstream (backend) server. The User-Agent is intentionally removed from responses as shown here.
https://github.com/tobychui/zoraxy/blob/0657c2b8ce5b98df2547a53cb38bbf2b6a1e5979/src/mod/dynamicproxy/dpcore/dpcore.go#L333-L337
It is an known issue that Pelican Wings project are misusing the User-Agent header. According to w3c specification, they should use Client Hint header instead.
If you really want to use this project with Zoraxy, you can remove the above section of code and build it yourself.