Skeleton contracts / contracts (pull_request) Blocked by required conditions
34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
map $ssl_client_s_dn $lb_identity_allowed {
|
|
default 0;
|
|
~CN=messenger-lb$ 1;
|
|
}
|
|
server {
|
|
listen 8443 ssl;
|
|
server_name api1 api2;
|
|
ssl_certificate /run/tls/api.crt;
|
|
ssl_certificate_key /run/tls/api.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_client_certificate /run/tls/lb-ca.crt;
|
|
ssl_verify_client on;
|
|
ssl_verify_depth 2;
|
|
client_max_body_size 11m;
|
|
error_page 502 504 = @app_unavailable;
|
|
|
|
location / {
|
|
if ($lb_identity_allowed = 0) { return 403; }
|
|
proxy_pass http://127.0.0.1:8080;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_set_header Host $host;
|
|
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;
|
|
}
|
|
location @app_unavailable {
|
|
default_type application/json;
|
|
add_header X-Request-Id $request_id always;
|
|
add_header X-Instance-Id $server_name always;
|
|
return 503 '{"error":{"code":"unavailable","message":"API process unavailable","request_id":"$request_id"}}';
|
|
}
|
|
}
|