Files

42 lines
1.3 KiB
Nginx Configuration File

events {}
http {
upstream api_secure {
server api-gw1:8443 max_fails=1 fail_timeout=2s;
server api-gw2:8443 max_fails=1 fail_timeout=2s;
}
server {
listen 8443 ssl;
server_name localhost;
ssl_certificate /pki/server.crt;
ssl_certificate_key /pki/server.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:SSL:5m;
client_max_body_size 11m;
location / {
proxy_pass https://api_secure;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 3s;
proxy_read_timeout 30s;
proxy_send_timeout 30s;
# A stopped replica makes its gateway answer 502; retry the other
# gateway. Message POSTs carry Idempotency-Key, so a retry is safe.
proxy_next_upstream error timeout http_502 http_503 http_504;
proxy_next_upstream_tries 2;
proxy_next_upstream_timeout 3s;
# Mandatory mTLS to every API replica: verify the gateway chain and
# present the LB identity certificate.
proxy_ssl_verify on;
proxy_ssl_trusted_certificate /pki/ca.crt;
proxy_ssl_certificate /pki/lb.crt;
proxy_ssl_certificate_key /pki/lb.key;
proxy_ssl_server_name on;
proxy_ssl_name api-gw1;
}
}
}