Files
oauth2-proxy/contrib/local-environment/nginx.conf
github-actions[bot]andJan Larwig 5961fd99b4 release v7.15.2 (#3413)
* update to release version v7.15.2

* doc: add changelog entry for v7.15.2

Signed-off-by: Jan Larwig <jan@larwig.com>

* fix(deps): override webpackbar to v7 for webpack 5.106.0 compatibility

As outlined in https://github.com/facebook/docusaurus/issues/11923

Signed-off-by: Jan Larwig <jan@larwig.com>

* chore: fix local test files for nginx setup

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-04-14 13:12:28 +02:00

45 lines
1.5 KiB
Nginx Configuration File

# Reverse proxy to httpbin
server {
listen 8080;
server_name oauth2-proxy.localtest.me;
location /oauth2/ {
proxy_pass http://oauth2-proxy:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Uri $request_uri;
proxy_set_header X-Auth-Request-Redirect $request_uri;
}
location = /oauth2/auth {
proxy_pass http://oauth2-proxy:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Uri $request_uri;
# nginx auth_request includes headers but not body
proxy_set_header Content-Length "";
proxy_pass_request_body off;
}
location / {
auth_request /oauth2/auth;
error_page 401 = @oauth2_signin;
# pass information via X-User and X-Email headers to backend,
# requires running with --set-xauthrequest flag
auth_request_set $user $upstream_http_x_auth_request_user;
auth_request_set $email $upstream_http_x_auth_request_email;
proxy_set_header X-User $user;
proxy_set_header X-Email $email;
proxy_pass http://httpbin/;
# or "root /path/to/site;" or "fastcgi_pass ..." etc
}
# Named location for handling OAuth2 sign-in redirects
# This ensures the browser receives a proper 302 redirect that it will follow
location @oauth2_signin {
return 302 /oauth2/sign_in?rd=$scheme://$http_host$request_uri;
}
}