Skeleton contracts / contracts (pull_request) Blocked by required conditions
59 lines
1.9 KiB
Nginx Configuration File
59 lines
1.9 KiB
Nginx Configuration File
pid /tmp/nginx.pid;
|
|
events { worker_connections 512; }
|
|
|
|
http {
|
|
access_log off;
|
|
server_tokens off;
|
|
client_body_temp_path /tmp/nginx-body;
|
|
proxy_temp_path /tmp/nginx-proxy;
|
|
fastcgi_temp_path /tmp/nginx-fastcgi;
|
|
uwsgi_temp_path /tmp/nginx-uwsgi;
|
|
scgi_temp_path /tmp/nginx-scgi;
|
|
|
|
limit_req_zone $binary_remote_addr zone=logins:1m rate=2r/s;
|
|
|
|
upstream api_backend {
|
|
zone api_backend 64k;
|
|
resolver 127.0.0.11 valid=5s ipv6=off;
|
|
least_conn;
|
|
server app1:8443 resolve max_fails=1 fail_timeout=5s;
|
|
server app2:8443 resolve max_fails=1 fail_timeout=5s;
|
|
}
|
|
|
|
server {
|
|
listen 8443 ssl;
|
|
ssl_certificate /run/identity/server.crt;
|
|
ssl_certificate_key /run/identity/server.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
client_max_body_size 10m;
|
|
|
|
proxy_ssl_certificate /run/identity/lb.crt;
|
|
proxy_ssl_certificate_key /run/identity/lb.key;
|
|
proxy_ssl_trusted_certificate /run/ca/ca.crt;
|
|
proxy_ssl_verify on;
|
|
proxy_ssl_server_name on;
|
|
proxy_ssl_name api.internal;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For "";
|
|
proxy_next_upstream error timeout http_502 http_503 http_504;
|
|
proxy_connect_timeout 2s;
|
|
proxy_read_timeout 10s;
|
|
|
|
location = /api/v1/auth/sessions {
|
|
limit_req zone=logins burst=12 nodelay;
|
|
limit_req_status 429;
|
|
error_page 429 = @rate_limited;
|
|
proxy_pass https://api_backend;
|
|
}
|
|
location @rate_limited {
|
|
default_type application/json;
|
|
add_header Retry-After 1 always;
|
|
add_header X-Request-Id $request_id always;
|
|
return 429 '{"error":{"code":"rate_limited","message":"Too many login requests","request_id":"$request_id"}}';
|
|
}
|
|
location / {
|
|
proxy_pass https://api_backend;
|
|
}
|
|
}
|
|
}
|