blob: 3477353cda5801ea3e700588c6147498442ee79d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# nginx -p . -c nginx.conf
pid /tmp/nginx.example.pid;
daemon off;
events {
worker_connections 5;
}
http {
access_log /dev/stdout;
error_log /dev/stderr;
server {
server_name localhost;
location /auth {
rewrite /auth/(.+) /$1 break;
proxy_pass http://127.0.0.1:8080; # This is the TOTP Server
proxy_set_header X-Totp-Secret baadf00d;
proxy_set_header X-Totp-Secret deadc0de;
}
# This ensures that if the TOTP server returns 401 we redirect to login
error_page 401 = @error401;
location @error401 {
return 302 /auth/login$request_uri;
}
location / {
auth_request /auth/check;
}
}
}
|