Last active
April 27, 2018 09:49
-
-
Save micw/00659522bc1ef64257006c1cc6da3d24 to your computer and use it in GitHub Desktop.
Nginx auth with login-form passthrough
This file contains 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
# This variant uses the same endpoint for the check and the login form | |
server { | |
listen 80; | |
server_name localhost; | |
location = /internal-nginx-auth-endpoint { | |
internal; | |
proxy_pass http://172.17.0.1:8080/; | |
} | |
error_page 401 = /internal-nginx-auth-endpoint; | |
location / { | |
auth_request /internal-nginx-auth-endpoint; | |
} | |
} |
This file contains 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
# This variant uses the a minimal endpoint for the check and a different one for the login form | |
server { | |
listen 80; | |
server_name localhost; | |
location = /internal-nginx-auth-login-endpoint { | |
internal; | |
proxy_pass http://172.17.0.1:8080/login; | |
} | |
location = /internal-nginx-auth-check-endpoint { | |
internal; | |
proxy_pass http://172.17.0.1:8080/check; | |
proxy_pass_request_body off; | |
proxy_set_header Content-Length ""; | |
} | |
error_page 401 = /internal-nginx-auth-login-endpoint; | |
location / { | |
auth_request /internal-nginx-auth-check-endpoint; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment