Files
mtusi2026lab7/infra/api-nginx.conf
T

41 lines
1.4 KiB
Plaintext

proxy_temp_path /tmp/nginx-proxy 1 2;
fastcgi_temp_path /tmp/nginx-fastcgi 1 2;
uwsgi_temp_path /tmp/nginx-uwsgi 1 2;
scgi_temp_path /tmp/nginx-scgi 1 2;
server {
access_log /dev/stdout;
error_log /dev/stderr warn;
listen 8443 ssl;
server_name api;
ssl_certificate /run/secrets/api-server.crt;
ssl_certificate_key /tmp/api-server.key;
ssl_client_certificate /run/secrets/internal-ca.crt;
ssl_crl /run/secrets/pki-int.crl.pem;
ssl_verify_client on;
ssl_verify_depth 1;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_tickets off;
# Chain validation alone is insufficient: only the dedicated load-balancer
# identity may cross this boundary.
if ($ssl_client_s_dn != "CN=messenger-lb") { return 403; }
client_max_body_size 11m;
client_body_temp_path /tmp/nginx-client-body 1 2;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
# This listener accepts only the LB's authenticated certificate, and
# the LB overwrites X-Forwarded-For with the socket peer address.
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Request-Id $request_id;
proxy_request_buffering off;
proxy_buffering off;
}
}