Skip to content

Commit 1da0cc1

Browse files
committed
Fix OIDC client authentication for POST method after f7e8726
Remove the `proxy_pass_request_body off` directive, which unintentionally broke OIDC client authentication using the POST body method (`client_secret_post`). Previously, when `$oidc_client_auth_method` was set to "client_secret_post" the `generateTokenRequestParams()` function correctly formatted the POST request and sent it via `r.subrequest` to the internal `/_token` location. However, the `proxy_pass_request_body off` directive caused the POST request to reach `$oidc_token_endpoint` with a valid Content-Length header but an empty body. This led to a timeout as the OP token endpoint closed the connection. Users encountered the error: "NGINX / OpenID Connect login failure." This commit restores functionality by ensuring the request body is passed to the token endpoint while retaining header exclusion to prevent CORS issues.
1 parent f7e8726 commit 1da0cc1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

openid_connect.server_conf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@
3838
# http://openid.net/specs/openid-connect-core-1_0.html#TokenRequest
3939
internal;
4040

41-
# Do not pass through body or headers from the client, this should be a net-new connection.
42-
# Some IdPs, like Microsoft Entra, will throw CORS errors if client headers are passed through.
41+
# Exclude client headers to avoid CORS errors with certain IdPs (e.g., Microsoft Entra ID)
4342
proxy_pass_request_headers off;
44-
proxy_pass_request_body off;
4543

4644
proxy_ssl_server_name on; # For SNI to the IdP
4745
proxy_set_header Content-Type "application/x-www-form-urlencoded";
@@ -55,10 +53,8 @@
5553
# https://openid.net/specs/openid-connect-core-1_0.html#RefreshingAccessToken
5654
internal;
5755

58-
# Do not pass through body or headers from the client, this should be a net-new connection.
59-
# Some IdPs, like Microsoft Entra, will throw CORS errors if client headers are passed through.
56+
# Exclude client headers to avoid CORS errors with certain IdPs (e.g., Microsoft Entra ID)
6057
proxy_pass_request_headers off;
61-
proxy_pass_request_body off;
6258

6359
proxy_ssl_server_name on; # For SNI to the IdP
6460
proxy_set_header Content-Type "application/x-www-form-urlencoded";

0 commit comments

Comments
 (0)