fix: Proxy-Authorization header silently stripped by axios - #7773
Open
DennisGaida wants to merge 1 commit into
Open
fix: Proxy-Authorization header silently stripped by axios#7773DennisGaida wants to merge 1 commit into
DennisGaida wants to merge 1 commit into
Conversation
axios's Node HTTP adapter unconditionally deletes any header named Proxy-Authorization unless a real upstream proxy is configured, even when the user explicitly set it as a custom monitor header. This breaks the common Traefik forward-auth + Authelia pattern of using Proxy-Authorization for non-interactive service-account bypass. Reinject the header directly on the outgoing request via a wrapped agent.addRequest, after axios has already sanitized its own headers object, so it reaches the wire regardless of axios's internal handling. Also add "HTTP Basic Auth (Proxy-Authorization)" as a first-class Authentication method, reusing the existing basic_auth_user/ basic_auth_pass fields, so this doesn't require reverse-engineering a raw-header workaround. Fixes louislam#7768
Contributor
|
Thanks for the PR! If anyone would like to help with testing, run: |
DennisGaida
marked this pull request as ready for review
August 25, 2026 18:17
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.
Summary
In this pull request, the following changes are made:
Proxy-Authorizationunless a real upstream proxy is configured (removeProxyAuthorizationinlib/adapters/http.js), even when the user explicitly set it via the monitor's Headers field. This breaks the common Traefik forward-auth + Authelia pattern of usingProxy-Authorizationfor non-interactive service-account bypass (distinct fromAuthorization, which is reserved for the backend app).Proxy-Authorizationvia the Header field in uptime-kuma for a while, but at some point this stopped working and I just got around to investigating why this was.agent.addRequest, right before dispatch and after axios has already sanitized its ownoptions.headers— so it reaches the wire regardless of axios's internal handling.HTTP Basic Auth (Proxy-Authorization)(id:proxy-basic) as a new Authentication method in the dropdown, reusing the existingbasic_auth_user/basic_auth_passfields (no schema change) so this is discoverable instead of requiring a raw custom-header workaround. I am completely open to just naming this "Proxy-Authorization" instead of HTTP Basic Auth (Proxy-Authorization)", wasn't sure what is better.Fixes #7772
Please follow this checklist to avoid unnecessary back and forth (click to expand)
I understand that I am responsible for and able to explain every line of code I submit.
Status / what's still open
addRequestreinjection + newproxy-basicauth method) verified against a real production Authelia/Traefik forward-auth deployment: header now reaches the destination, monitor reports UP again.{"Proxy-Authorization": "Basic xxx"}does not produce the header (eaten by axios), using the new "HTTP Basic Auth (Proxy-Authorization)" choice for authentication, produces the header and I am authenticated.addRequestreinjection specifically — open to suggestions on the best way to cover this given it touches raw agent/socket behavior rather than something easily mockable at the axios-config level - and also I am not sure whether other libraries than axios would exhibit the same behavior.Screenshots for Visual Changes
I'm not sure whether screenshots of a new dropdown value are necessary, because the juice is in the backend (axios), but anyways - here is the new option:
and here is the option including the existing (basic auth) fields:
