@@ -79,6 +79,60 @@ requests with the `Host` header with subdomain values matching
7979
8080Default: ` localhost `
8181
82+ > [ !IMPORTANT]
83+ > ** Reverse Proxy Requirement:** When running Rainbow behind a reverse proxy
84+ > (such as nginx), the original ` Host ` header ** must** be forwarded to Rainbow
85+ > for subdomain gateway routing to work. Rainbow uses the ` Host ` header to
86+ > detect subdomain patterns like ` {cid}.ipfs.example.org ` .
87+ >
88+ > If the ` Host ` header is not forwarded correctly, Rainbow will not recognize
89+ > subdomain requests and will return the default landing page instead of the
90+ > expected IPFS content.
91+ >
92+ > If ` X-Forwarded-Proto ` is not set, redirects over HTTPS will use wrong protocol
93+ > and DNSLink names will not be inlined for subdomain gateways.
94+ >
95+ > Example: minimal nginx configuration for ` example.org `
96+ >
97+ > ``` nginx
98+ > server {
99+ > listen 80;
100+ > listen [::]:80;
101+ >
102+ > # IMPORTANT: Include wildcard to match subdomain gateway requests.
103+ > # The dot prefix matches both apex domain and all subdomains.
104+ > server_name .example.org;
105+ >
106+ > location / {
107+ > proxy_pass http://127.0.0.1:8090;
108+ >
109+ > # IMPORTANT: Forward the original Host header to Rainbow.
110+ > # Without this, subdomain gateway routing will not work.
111+ > proxy_set_header Host $host;
112+ >
113+ > # IMPORTANT: X-Forwarded-Proto is required for correct behavior:
114+ > # - Redirects will use https:// URLs when set to "https"
115+ > # - DNSLink names will be inlined for subdomain gateways
116+ > # (e.g., /ipns/en.wikipedia-on-ipfs.org → en-wikipedia--on--ipfs-org.ipns.example.org)
117+ > proxy_set_header X-Forwarded-Proto $scheme;
118+ > proxy_set_header X-Forwarded-Host $host;
119+ > }
120+ > }
121+ > ```
122+ >
123+ > Common mistakes to avoid:
124+ >
125+ > - **Missing wildcard in `server_name`:** Using only `server_name example.org;`
126+ > will not match subdomain requests like `{cid}.ipfs.example.org`. Always
127+ > include `*.example.org` or use the dot prefix `.example.org`.
128+ >
129+ > - **Wrong `Host` header value:** Using `proxy_set_header Host $proxy_host;`
130+ > sends the backend's hostname (e.g., `127.0.0.1:8090`) instead of the
131+ > original `Host` header. Always use `$host` or `$http_host`.
132+ >
133+ > - **Missing `Host` header entirely:** If `proxy_set_header Host` is not
134+ > specified, nginx defaults to `$proxy_host`, which breaks subdomain routing.
135+
82136### `RAINBOW_TRUSTLESS_GATEWAY_DOMAINS`
83137
84138Specifies trustless-only hostnames.
0 commit comments