Skip to content

Instantly share code, notes, and snippets.

@matutter
Created August 24, 2018 01:01
Show Gist options
  • Select an option

  • Save matutter/494e402ca16ea01ea4b22bf44b9b5f87 to your computer and use it in GitHub Desktop.

Select an option

Save matutter/494e402ca16ea01ea4b22bf44b9b5f87 to your computer and use it in GitHub Desktop.
Using an internal authentication service to verify requests.
http {
#...
server {
#...
location /private/ {
auth_request /auth;
auth_request_set $auth_status $upstream_status;
}
location = /auth {
internal;
proxy_pass http://auth-server;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment