Skip to content

fix: Proxy-Authorization header silently stripped by axios - #7773

Open
DennisGaida wants to merge 1 commit into
louislam:masterfrom
DennisGaida:fix/proxy-authorization-header-stripped
Open

fix: Proxy-Authorization header silently stripped by axios#7773
DennisGaida wants to merge 1 commit into
louislam:masterfrom
DennisGaida:fix/proxy-authorization-header-stripped

Conversation

@DennisGaida

Copy link
Copy Markdown

Summary

In this pull request, the following changes are made:

  • axios's Node HTTP adapter unconditionally strips any header named Proxy-Authorization unless a real upstream proxy is configured (removeProxyAuthorization in lib/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 using Proxy-Authorization for non-interactive service-account bypass (distinct from Authorization, which is reserved for the backend app).
    • This is actually a regression, but I didn't dig into when this change happened - I have been using Proxy-Authorization via 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.
  • Reinjects the header directly on the outgoing request via a wrapped agent.addRequest, right before dispatch and after axios has already sanitized its own options.headers — so it reaches the wire regardless of axios's internal handling.
  • Adds HTTP Basic Auth (Proxy-Authorization) (id: proxy-basic) as a new Authentication method in the dropdown, reusing the existing basic_auth_user/basic_auth_pass fields (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)
  • ⚠️ If there are Breaking change (a fix or feature that alters existing functionality in a way that could cause issues) I have called them out
  • 🧠 I have disclosed any use of LLMs/AI in this contribution and reviewed all generated content.
    I understand that I am responsible for and able to explain every line of code I submit.
  • 🔍 Any UI changes adhere to visual style of this project.
  • 🛠️ I have self-reviewed and self-tested my code to ensure it works as expected.
  • 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
  • 🤖 I added or updated automated tests where appropriate.
  • 📄 Documentation updates are included (if applicable).
  • 🧰 Dependency updates are listed and explained.
  • ⚠️ CI passes and is green.

Status / what's still open

  • Backend fix (addRequest reinjection + new proxy-basic auth method) verified against a real production Authelia/Traefik forward-auth deployment: header now reaches the destination, monitor reports UP again.
  • Have tested end-to-end: Using {"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.
  • No automated test added yet for the addRequest reinjection 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:

image

and here is the option including the existing (basic auth) fields:
image

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
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the PR! If anyone would like to help with testing, run: npx kuma-pr DennisGaida:fix/proxy-authorization-header-stripped (requires Node.js and Docker)

@DennisGaida
DennisGaida marked this pull request as ready for review August 25, 2026 18:17
@github-actions github-actions Bot added the pr:needs review this PR needs a review by maintainers or other community members label Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:needs review this PR needs a review by maintainers or other community members

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proxy-Authorization header is silently stripped, breaking Authelia/Traefik forward-auth service-account bypass

1 participant