map $http_x_request_id $adapter_request_id { "~^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$" $http_x_request_id; default $request_id; } map $http_upgrade $connection_upgrade { default upgrade; "" close; } limit_req_zone $binary_remote_addr zone=adapter_retrieval:10m rate=10r/s; limit_req_zone $binary_remote_addr zone=adapter_assets:10m rate=30r/s; server { listen 80 default_server; listen [::]:80 default_server; server_name _; access_log off; return 404; } server { listen 80; listen [::]:80; server_name weknora-test.dobot.cn; server_tokens off; client_max_body_size 64m; add_header X-Content-Type-Options nosniff always; add_header Referrer-Policy no-referrer always; location / { proxy_pass http://127.0.0.1:8088; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_connect_timeout 3s; proxy_send_timeout 300s; proxy_read_timeout 300s; proxy_buffering off; proxy_hide_header Server; proxy_hide_header X-Powered-By; } } server { listen 80; listen [::]:80; server_name weknora-api-test.dobot.cn; server_tokens off; access_log off; error_log /var/log/nginx/weknora-api-test-error.log error; client_max_body_size 64k; add_header X-Content-Type-Options nosniff always; add_header Referrer-Policy no-referrer always; location = /retrieval { limit_except POST { deny all; } limit_req zone=adapter_retrieval burst=20 nodelay; proxy_pass http://127.0.0.1:18080; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header Connection ""; proxy_set_header Authorization $http_authorization; proxy_set_header Content-Type $content_type; proxy_set_header X-Request-ID $adapter_request_id; proxy_set_header X-Forwarded-Proto https; proxy_connect_timeout 3s; proxy_send_timeout 20s; proxy_read_timeout 20s; proxy_intercept_errors off; proxy_hide_header Server; proxy_hide_header X-Powered-By; } location ~ "^/i/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" { limit_except GET { deny all; } limit_req zone=adapter_assets burst=60 nodelay; proxy_pass http://127.0.0.1:18080; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header Connection ""; proxy_set_header X-Request-ID $adapter_request_id; proxy_set_header X-Forwarded-Proto https; proxy_connect_timeout 3s; proxy_send_timeout 10s; proxy_read_timeout 10s; proxy_intercept_errors off; proxy_hide_header Server; proxy_hide_header X-Powered-By; } location = /healthz { allow 127.0.0.1; allow ::1; deny all; proxy_pass http://127.0.0.1:18080; proxy_set_header X-Request-ID $adapter_request_id; proxy_connect_timeout 2s; proxy_read_timeout 2s; proxy_intercept_errors off; } location / { return 404; } }