docs: add nginx example (#1329)

* docs: add nginx example

Co-authored-by: bobby <1544881+desimone@users.noreply.github.com>
This commit is contained in:
Travis Groth 2020-08-26 17:10:23 -04:00 committed by GitHub
parent 51bdf9baae
commit a69b9957a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 336 additions and 0 deletions

View file

@ -0,0 +1,37 @@
# Protected application
server {
listen 443 ssl;
listen 80;
server_name httpbin.localhost.pomerium.io;
ssl_certificate /etc/nginx/nginx.pem;
ssl_certificate_key /etc/nginx/nginx-key.pem;
location / {
proxy_pass http://httpbin;
}
### External Authorization
# Send auth check to /authorize location.
auth_request /authorize;
# Set cookies we get back from the auth check
auth_request_set $saved_set_cookie $upstream_http_set_cookie;
add_header Set-Cookie $saved_set_cookie;
# If we get a 401, respond with a named location
error_page 401 = @error401;
# On 401, redirect the user to forward auth to start authentication flow
location @error401 {
return 302 https://fwdauth.localhost.pomerium.io/?uri=$scheme://$http_host$request_uri;
}
# The auth request must be a subpath of the server
location /authorize {
proxy_pass http://pomerium/verify?uri=$scheme://$http_host$request_uri;
proxy_set_header Host fwdauth.localhost.pomerium.io;
proxy_http_version 1.1;
}
### End External Authorization
}