74 lines
2.5 KiB
Nginx Configuration File
74 lines
2.5 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
large_client_header_buffers 4 16k;
|
|
|
|
location = /health {
|
|
access_log off;
|
|
default_type text/plain;
|
|
return 200 "ok\n";
|
|
}
|
|
|
|
location = /oauth2/auth {
|
|
internal;
|
|
proxy_pass http://oauth2-proxy:4180;
|
|
proxy_pass_request_body off;
|
|
proxy_set_header Content-Length "";
|
|
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Host $http_host;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Uri $request_uri;
|
|
}
|
|
|
|
location /oauth2/ {
|
|
proxy_pass http://oauth2-proxy:4180;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Host $http_host;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Auth-Request-Redirect $scheme://$http_host$request_uri;
|
|
}
|
|
|
|
location = /api/edge {
|
|
auth_request /oauth2/auth;
|
|
error_page 401 = @api_unauthorized;
|
|
|
|
auth_request_set $auth_user $upstream_http_x_auth_request_user;
|
|
auth_request_set $auth_email $upstream_http_x_auth_request_email;
|
|
auth_request_set $auth_cookie $upstream_http_set_cookie;
|
|
add_header Set-Cookie $auth_cookie always;
|
|
|
|
proxy_pass http://app:8081/edge/me;
|
|
proxy_set_header X-Auth-Request-User $auth_user;
|
|
proxy_set_header X-Auth-Request-Email $auth_email;
|
|
}
|
|
|
|
location / {
|
|
auth_request /oauth2/auth;
|
|
error_page 401 = @oauth2_signin;
|
|
|
|
auth_request_set $auth_user $upstream_http_x_auth_request_user;
|
|
auth_request_set $auth_email $upstream_http_x_auth_request_email;
|
|
auth_request_set $auth_cookie $upstream_http_set_cookie;
|
|
add_header Set-Cookie $auth_cookie always;
|
|
|
|
proxy_pass http://app:8081/edge/me;
|
|
proxy_set_header X-Auth-Request-User $auth_user;
|
|
proxy_set_header X-Auth-Request-Email $auth_email;
|
|
}
|
|
|
|
location @oauth2_signin {
|
|
return 302 $scheme://$http_host/oauth2/start?rd=$scheme://$http_host$request_uri;
|
|
}
|
|
|
|
location @api_unauthorized {
|
|
default_type application/json;
|
|
return 401 '{"error":"authentication required"}';
|
|
}
|
|
}
|