Skip to content

fix(nginx): forward Authorization header to php-fpm (pfSense >= 2.9) - #983

Closed
lemassykoi wants to merge 1 commit into
pfrest:masterfrom
lemassykoi:fix/nginx-forward-auth-header
Closed

lemassykoi wants to merge 1 commit into
pfrest:masterfrom
lemassykoi:fix/nginx-forward-auth-header

Conversation

@lemassykoi

@lemassykoi lemassykoi commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #982 — one-line fix for the pfSense >= 2.9 nginx webConfigurator, where Authorization is never forwarded to php-fpm, making every API request 401 AUTH_AUTHENTICATION_FAILED even with a valid key.

The package's own location hook is the correct place for the
fastcgi_param HTTP_AUTHORIZATION \$http_authorization; line, since fastcgi_params is owned by pfSense core.

  • Verified on live pfSense CE 2.9.2 + pkg 2.11_1: KeyAuth requests return data after the param is present in the generated config.

pfSense >= 2.9 serves the webConfigurator through nginx + php-fpm, which
only exposes request headers to PHP via explicit fastcgi_param entries.
The package's generated /api/v2/ location omitted HTTP_AUTHORIZATION, so
$_SERVER['HTTP_AUTHORIZATION'] was always empty in Auth::get_auth_key()
and every KeyAuth/Bearer/JWT request failed with AUTH_AUTHENTICATION_FAILED
despite valid credentials. Add the forwarding param to the location hook.
@lemassykoi

Copy link
Copy Markdown
Contributor Author

Withdrawing — my nginx 'missing forwarding' theory was wrong. nginx's FastCGI module maps all request headers to HTTP_* automatically: our 2.9.2 box authenticated with x-api-key using the stock, unmodified nginx config, which proves nothing was ever stripped (Authorization included). The 401s were simply KeyAuth expecting x-api-key (since 3313e2b) while my client/docs-derived usage sent Authorization: Key. The genuine fix is on the docs side — see the edited #982. Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: KeyAuth now reads the x-api-key header, but examples/docs still advertise 'Authorization: Key'

1 participant