interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / infra / nginx / snippets / forge-proxy.conf

54 lines · 2655 bytes Raw Blame History
1# /etc/nginx/snippets/forge-proxy.conf on hub - shared proxy settings for every forged location.
2# Include inside a location, then set X-Forge-Base and proxy_pass in that same location
3# (proxy_set_header there replaces the inherited list, so every header lives in one place).
4# Requires conf.d/forge.conf (upstream forged, zone forge_post, map $forge_post_noaddr).
5
6if ($forge_post_noaddr) { return 503; }
7limit_except GET HEAD POST { deny all; }
8limit_req zone=forge_post burst=10 nodelay;
9limit_req zone=forge_other_reads burst=30 nodelay;
10limit_req zone=forge_source_pages burst=128 delay=8;
11limit_req zone=forge_bots burst=10;
12limit_req_status 429;
13limit_conn forge_git_history 3;
14limit_conn_status 429;
15
16# Body size: client_max_body_size is the including server block's (64k on interplane.io), so the
17# one location that takes larger bodies (the git patch upload, 3145728 bytes) can raise it; set
18# here too, it would be a duplicate directive in that location.
19client_body_buffer_size 64k;
20
21# forged speaks HTTP/1.1, but nginx->upstream stays HTTP/1.0 + Connection: close: one
22# request per connection, so a close-delimited streamed body is always well framed.
23proxy_http_version 1.0;
24proxy_connect_timeout 5s;
25proxy_send_timeout 30s;
26# proxy_read_timeout is nginx's default 60s here; forge-archive.conf raises it to 300s
27# (setting it in both files would be a duplicate directive in the archive locations).
28proxy_redirect off;
29proxy_intercept_errors off;
30
31# forged serves one connection at a time, so a slow reader must never hold it (security review
32# P2-1). nginx reads every response from forged at tunnel speed and spools what the client has
33# not taken yet to /var/lib/nginx/proxy (cap 600m per response; forged's own cap is 512 MiB).
34# A client that accepts nothing for 60 s is dropped.
35proxy_buffering on;
36proxy_max_temp_file_size 600m;
37send_timeout 60s;
38
39# Client copies of these headers never reach forged: every one is overwritten here.
40proxy_set_header Host $host;
41proxy_set_header X-Real-IP $proxy_protocol_addr;
42proxy_set_header X-Forwarded-For $proxy_protocol_addr;
43proxy_set_header X-Forwarded-Proto https;
44proxy_set_header X-Forwarded-Host $host;
45proxy_set_header Authorization "";
46proxy_set_header Proxy "";
47
48# The edge headers (forge-headers.conf) are authoritative, except Content-Security-Policy:
49# forged's own policy (page or raw sandbox) passes through, see $forge_csp_edge in conf.d/forge.conf.
50proxy_hide_header Strict-Transport-Security;
51proxy_hide_header X-Frame-Options;
52proxy_hide_header Referrer-Policy;
53proxy_hide_header X-Content-Type-Options;
54proxy_hide_header X-Powered-By;