# Authentik behind exe.dev's HTTPS proxy. From https://exe.dev/deploy/authentik. # :8000 is the public face: login pages, the user dashboard, OIDC/SAML endpoints, # and the API that those pages and outposts use. The admin interface is refused. # :8080 stays behind exe.dev login: the whole of Authentik, admin interface included. # Install replaces my-authentik.exe.xyz with this VM's name. # exe.dev appends the visitor's address to X-Forwarded-For; keep only that. map $http_x_forwarded_for $ak_client { "~(?[^,\s]+)\s*$" $last; default $remote_addr; } map $http_upgrade $ak_connection { default upgrade; "" ""; } server { listen 8000; listen [::]:8000; proxy_http_version 1.1; proxy_set_header Host my-authentik.exe.xyz; proxy_set_header X-Forwarded-Host my-authentik.exe.xyz; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-For $ak_client; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $ak_connection; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; absolute_redirect off; location /if/admin/ { return 302 https://my-authentik.exe.xyz:8080/if/admin/; } location = /robots.txt { return 200 "User-agent: *\nDisallow: /\n"; } location / { proxy_pass http://127.0.0.1:9000; } } server { listen 8080; listen [::]:8080; proxy_http_version 1.1; proxy_set_header Host my-authentik.exe.xyz:8080; proxy_set_header X-Forwarded-Host my-authentik.exe.xyz:8080; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-For $ak_client; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $ak_connection; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; absolute_redirect off; location = / { return 302 /if/admin/; } location / { proxy_pass http://127.0.0.1:9000; } }