Add two API replicas, safe object reconciliation, upload validation, regression tests and documented load experiments.
57 lines
2.1 KiB
Nginx Configuration File
57 lines
2.1 KiB
Nginx Configuration File
events {}
|
|
|
|
http {
|
|
# Capabilities are query strings; never write signed URLs to access logs.
|
|
server {
|
|
listen 9000;
|
|
access_log off;
|
|
error_log /dev/null;
|
|
client_max_body_size 10m;
|
|
client_body_timeout 15s;
|
|
location ~ "^/messenger-attachments/staging/[0-9a-f-]{36}/[0-9a-f-]{36}$" {
|
|
add_header Access-Control-Allow-Origin '*' always;
|
|
add_header Access-Control-Allow-Methods 'PUT, OPTIONS' always;
|
|
add_header Access-Control-Allow-Headers 'Content-Type, Content-Length, If-None-Match, x-amz-checksum-sha256' always;
|
|
add_header Access-Control-Expose-Headers 'ETag, x-amz-checksum-sha256' always;
|
|
if ($request_method = OPTIONS) { return 204; }
|
|
if ($request_method != PUT) { return 405; }
|
|
proxy_pass http://s3:9000;
|
|
proxy_request_buffering off;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header Connection '';
|
|
proxy_hide_header Access-Control-Allow-Origin;
|
|
proxy_hide_header Access-Control-Allow-Headers;
|
|
proxy_hide_header Access-Control-Allow-Methods;
|
|
proxy_connect_timeout 2s;
|
|
proxy_read_timeout 30s;
|
|
}
|
|
location / { return 403; }
|
|
}
|
|
|
|
upstream api {
|
|
least_conn;
|
|
zone api 64k;
|
|
include /etc/nginx/ready-upstreams.conf;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
client_max_body_size 11m;
|
|
|
|
location / {
|
|
proxy_pass http://api;
|
|
proxy_request_buffering off;
|
|
proxy_http_version 1.1;
|
|
# Preserve early 4xx responses while the client is still sending a body.
|
|
# The default Connection: close can make Node close before Nginx reads 413.
|
|
proxy_set_header Connection '';
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_connect_timeout 2s;
|
|
proxy_read_timeout 30s;
|
|
}
|
|
}
|
|
}
|