interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / infra / spark / nginx / sites-interplane.io

95 lines · 5358 bytes Raw Blame History
1# interplane.io + www: static site first, INTERPLANE Forge (forged) for every other path.
2# Reached only through the :443 SNI router (stream.d/sni-router.conf).
3# ForgeInfra, 2026-11-07. Source: spark ~/work/forge/web/infra/nginx/sites-enabled/interplane.io.
4# Previous file: /etc/nginx/forge-backups/<UTC>/sites-enabled_interplane.io (see infra/DEPLOY.md).
5server {
6 # 4444: plain TLS from the PROXY strip shim (127.0.0.1:4454). Kept so a router rollback
7 # needs no change here. 4448: the router sends interplane.io here WITH the PROXY header,
8 # so forge POST limits and X-Real-IP see the visitor address.
9 listen 127.0.0.1:4444 ssl http2; # Spark nginx 1.24: http2 per listen (Pi 1.28 uses "http2 on")
10 listen 127.0.0.1:4448 ssl http2 proxy_protocol; # Spark nginx 1.24: http2 per listen (Pi 1.28 uses "http2 on")
11 server_name interplane.io www.interplane.io;
12 ssl_certificate /etc/nginx/certs/interplane.io/fullchain.pem;
13 ssl_certificate_key /etc/nginx/certs/interplane.io/key.pem;
14 ssl_protocols TLSv1.2 TLSv1.3;
15 ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305;
16 ssl_prefer_server_ciphers off;
17 ssl_session_tickets off;
18 # Keep first connections alive through packet loss during TLS and header exchange.
19 # Returning clients can resume a session without enabling stateless tickets.
20 client_header_timeout 120s;
21 ssl_session_cache shared:interplane_sessions:4m;
22 access_log off;
23 root /var/www/interplane.io;
24 index index.html;
25 # Redirects stay relative: before this, /quick-start answered
26 # "Location: https://interplane.io:4444/quick-start/" (the internal listener port).
27 absolute_redirect off;
28 client_max_body_size 64k;
29 add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
30 add_header X-Content-Type-Options nosniff always;
31 add_header Referrer-Policy no-referrer always;
32 add_header Content-Security-Policy "default-src 'self'; script-src 'none'; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'none'; form-action 'self'; frame-ancestors 'none'" always;
33
34 # L1057 guard, 2026-11-10 (one-interplane): the deployed forged build 408091d1 exits when the path
35 # segment after /patches/ or /issues/ is longer than 128 bytes (collab copost scan). Refuse that
36 # shape here so it never reaches forged. Remove after a build containing fix 5b6bbfd is deployed.
37 location ~ "/(patches|issues)/[^/]{129,}" { return 404; }
38
39 # Existing static files (and directories with index.html) first; everything else is forged.
40 location / {
41 try_files $uri $uri/ @forged;
42 }
43
44 location @forged {
45 include /etc/nginx/snippets/forge-headers.conf;
46 include /etc/nginx/snippets/forge-proxy.conf;
47 proxy_cache forge_pages;
48 proxy_cache_key "$host|$request_uri|$forge_json";
49 proxy_cache_valid 200 301 404 30s;
50 proxy_ignore_headers Cache-Control Expires;
51 proxy_cache_bypass $forge_nocache;
52 proxy_no_cache $forge_nocache;
53 proxy_cache_lock on;
54 proxy_cache_lock_timeout 10s;
55 proxy_cache_use_stale error timeout updating http_502 http_504;
56 proxy_cache_background_update on;
57 add_header X-Forge-Cache $upstream_cache_status always;
58 add_header Vary Accept always;
59 proxy_set_header X-Forge-Base "/";
60 proxy_pass http://forged;
61 }
62
63 # Downloads (zip / tar.gz per ref, raw files, release assets): buffered, concurrency-capped.
64 location ~ "^/[^/]+/[^/]+/(archive|raw|releases/download)/" {
65 include /etc/nginx/snippets/forge-headers.conf;
66 include /etc/nginx/snippets/forge-proxy.conf;
67 include /etc/nginx/snippets/forge-archive.conf;
68 proxy_set_header X-Forge-Base "/";
69 proxy_pass http://forged;
70 }
71
72 # Git patch upload (POST /<owner>/<repo>/patches/new, docs/API.md "Git patches"): forged reads
73 # a body of up to 3145728 bytes (server/main.om HBCAP), so this path alone gets that limit;
74 # every other path keeps the server's 64k. Not cached (the form page carries a CSRF token).
75 location ~ "^/[^/]+/[^/]+/patches/new$" {
76 include /etc/nginx/snippets/forge-headers.conf;
77 include /etc/nginx/snippets/forge-proxy.conf;
78 client_max_body_size 3145728;
79 proxy_set_header X-Forge-Base "/";
80 proxy_pass http://forged;
81 }
82
83 # Bundle of an imported proposal (GET /<owner>/<repo>/patches/<id>.bundle, up to forged's
84 # 512 MiB): a download like the ones above, with the same includes, so it shares their
85 # limits (2 at a time per client and 6 in total, counted together with archive, raw and
86 # release downloads; 429 beyond) and is not kept in the page cache. Every other /patches
87 # path (<id>, <id>.patch, <id>.diff, the list) stays in @forged.
88 location ~ "^/[^/]+/[^/]+/patches/[0-9a-f]{16}\.bundle$" {
89 include /etc/nginx/snippets/forge-headers.conf;
90 include /etc/nginx/snippets/forge-proxy.conf;
91 include /etc/nginx/snippets/forge-archive.conf;
92 proxy_set_header X-Forge-Base "/";
93 proxy_pass http://forged;
94 }
95}