83 lines
3.2 KiB
Plaintext
83 lines
3.2 KiB
Plaintext
server {
|
|
listen 443 ssl;
|
|
server_name _;
|
|
server_tokens off;
|
|
client_max_body_size 1m;
|
|
|
|
ssl_certificate /etc/nginx/tls/tls.crt;
|
|
ssl_certificate_key /etc/nginx/tls/tls.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
add_header X-Frame-Options "DENY" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "no-referrer" always;
|
|
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
|
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; frame-ancestors 'none'; object-src 'none'; form-action 'self'; connect-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'" always;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
error_page 401 = /oauth2/sign_in?rd=https://$http_host$request_uri;
|
|
|
|
location = /oauth2/auth {
|
|
internal;
|
|
proxy_pass http://oauth2-proxy:4180/oauth2/auth;
|
|
proxy_pass_request_body off;
|
|
proxy_set_header Content-Length "";
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
proxy_set_header X-Auth-Request-Redirect https://$http_host$request_uri;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header X-Forwarded-Host $http_host;
|
|
}
|
|
|
|
location /oauth2/ {
|
|
proxy_pass http://oauth2-proxy:4180;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header X-Forwarded-Host $http_host;
|
|
}
|
|
|
|
location /api/v1/ {
|
|
auth_request /oauth2/auth;
|
|
auth_request_set $auth_user $upstream_http_x_auth_request_user;
|
|
auth_request_set $auth_groups $upstream_http_x_auth_request_groups;
|
|
auth_request_set $auth_access_token $upstream_http_x_auth_request_access_token;
|
|
|
|
proxy_pass http://control-panel-api:3010/api/v1/;
|
|
proxy_http_version 1.1;
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
proxy_read_timeout 360s;
|
|
proxy_send_timeout 360s;
|
|
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-Proto https;
|
|
|
|
# Remove every caller-supplied identity assertion. The API derives
|
|
# actor/role/scope only after cryptographic JWT verification.
|
|
proxy_set_header X-CASAN-Actor "";
|
|
proxy_set_header X-CASAN-Groups "";
|
|
proxy_set_header X-CASAN-Role "";
|
|
proxy_set_header X-CASAN-Project "";
|
|
proxy_set_header X-CASAN-Tenant "";
|
|
proxy_set_header X-Forwarded-User "";
|
|
proxy_set_header X-Forwarded-Groups "";
|
|
proxy_set_header Authorization "Bearer $auth_access_token";
|
|
}
|
|
|
|
location = /healthz {
|
|
auth_request /oauth2/auth;
|
|
auth_request_set $auth_access_token $upstream_http_x_auth_request_access_token;
|
|
proxy_pass http://control-panel-api:3010/healthz;
|
|
proxy_set_header Authorization "Bearer $auth_access_token";
|
|
}
|
|
|
|
location / {
|
|
auth_request /oauth2/auth;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|