-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnginx-default.conf
More file actions
42 lines (38 loc) · 1.87 KB
/
Copy pathnginx-default.conf
File metadata and controls
42 lines (38 loc) · 1.87 KB
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
36
37
38
39
40
41
42
# SPA: serve index.html for client-side routing; listen on 8080 for OpenShift
server {
listen 8080;
root /usr/share/nginx/html;
index index.html;
# Security headers
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
location / {
try_files $uri $uri/ /index.html;
}
# Reverse-proxy /api requests to the backend service.
# __BACKEND_SERVICE_URL__ is replaced at container startup by docker-entrypoint.sh.
# __RESOLVER__ is replaced with the nameserver from /etc/resolv.conf so that
# nginx re-resolves the upstream hostname on each request rather than caching
# the IP at startup (which causes 502s after the backend container is restarted).
# All backend controllers use the /api/ prefix, so no path rewriting is needed.
# Using a variable in proxy_pass disables URI prefix replacement in nginx, so
# proxy_pass must point to just the upstream (no path suffix). nginx then passes
# the full request URI unchanged — e.g. /api/auth/me → backend:/api/auth/me.
location /api/ {
resolver __RESOLVER__ valid=10s;
set $upstream __BACKEND_SERVICE_URL__;
client_max_body_size 100m;
proxy_pass $upstream;
proxy_set_header Host $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 $scheme;
# The auth callback sets multiple JWT cookies (access_token, refresh_token,
# id_token, csrf_token) whose combined Set-Cookie headers exceed nginx's
# default proxy buffer size, causing 502 Bad Gateway.
proxy_buffer_size 16k;
proxy_buffers 4 16k;
}
}