interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

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

97 lines · 5409 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 include /etc/nginx/snippets/bazinga-git.conf;
35
36 # L1057 guard, 2026-11-10 (one-interplane): the deployed forged build 408091d1 exits when the path
37 # segment after /patches/ or /issues/ is longer than 128 bytes (collab copost scan). Refuse that
38 # shape here so it never reaches forged. Remove after a build containing fix 5b6bbfd is deployed.
39 location ~ "/(patches|issues)/[^/]{129,}" { return 404; }
40
41 # Existing static files (and directories with index.html) first; everything else is forged.
42 location / {
43 try_files $uri $uri/ @forged;
44 }
45
46 location @forged {
47 include /etc/nginx/snippets/forge-headers.conf;
48 include /etc/nginx/snippets/forge-proxy.conf;
49 proxy_cache forge_pages;
50 proxy_cache_key "$host|$request_uri|$forge_json";
51 proxy_cache_valid 200 301 404 30s;
52 proxy_ignore_headers Cache-Control Expires;
53 proxy_cache_bypass $forge_nocache;
54 proxy_no_cache $forge_nocache;
55 proxy_cache_lock on;
56 proxy_cache_lock_timeout 10s;
57 proxy_cache_use_stale error timeout updating http_502 http_504;
58 proxy_cache_background_update on;
59 add_header X-Forge-Cache $upstream_cache_status always;
60 add_header Vary Accept always;
61 proxy_set_header X-Forge-Base "/";
62 proxy_pass http://forged;
63 }
64
65 # Downloads (zip / tar.gz per ref, raw files, release assets): buffered, concurrency-capped.
66 location ~ "^/[^/]+/[^/]+/(archive|raw|releases/download)/" {
67 include /etc/nginx/snippets/forge-headers.conf;
68 include /etc/nginx/snippets/forge-proxy.conf;
69 include /etc/nginx/snippets/forge-archive.conf;
70 proxy_set_header X-Forge-Base "/";
71 proxy_pass http://forged;
72 }
73
74 # Git patch upload (POST /<owner>/<repo>/patches/new, docs/API.md "Git patches"): forged reads
75 # a body of up to 3145728 bytes (server/main.om HBCAP), so this path alone gets that limit;
76 # every other path keeps the server's 64k. Not cached (the form page carries a CSRF token).
77 location ~ "^/[^/]+/[^/]+/patches/new$" {
78 include /etc/nginx/snippets/forge-headers.conf;
79 include /etc/nginx/snippets/forge-proxy.conf;
80 client_max_body_size 3145728;
81 proxy_set_header X-Forge-Base "/";
82 proxy_pass http://forged;
83 }
84
85 # Bundle of an imported proposal (GET /<owner>/<repo>/patches/<id>.bundle, up to forged's
86 # 512 MiB): a download like the ones above, with the same includes, so it shares their
87 # limits (2 at a time per client and 6 in total, counted together with archive, raw and
88 # release downloads; 429 beyond) and is not kept in the page cache. Every other /patches
89 # path (<id>, <id>.patch, <id>.diff, the list) stays in @forged.
90 location ~ "^/[^/]+/[^/]+/patches/[0-9a-f]{16}\.bundle$" {
91 include /etc/nginx/snippets/forge-headers.conf;
92 include /etc/nginx/snippets/forge-proxy.conf;
93 include /etc/nginx/snippets/forge-archive.conf;
94 proxy_set_header X-Forge-Base "/";
95 proxy_pass http://forged;
96 }
97}