You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`AllViewerExceptHostHeader` forwards all viewer headers, query strings, and cookies to the origin while letting CloudFront set the `Host` header to `app.buildwithfern.com`. This is required — Fern's origin uses the `Host` header for routing and rejects requests with an unrecognized host.
-**Origin request policy**: `AllViewer` (forwards all headers, query strings, and cookies)
116
+
<Warning>
117
+
Do not use the `AllViewer` origin request policy. It forwards the viewer's `Host` header (your domain) instead of the origin's, which causes Fern's origin to return errors or raw React Server Component payloads instead of HTML.
118
+
</Warning>
119
+
</Step>
120
+
<Steptitle="Verify the behavior order">
100
121
101
-
To use a custom cache policy instead of `CachingDisabled`, set min, max, and default TTL to `0` and forward `Host` and `x-fern-host`.
122
+
CloudFront evaluates behaviors in order. Ensure your `/docs*` behavior appears **above** the default (`*`) behavior so docs requests are routed to Fern's origin rather than your primary site.
102
123
</Step>
103
124
</Steps>
104
125
105
126
<Warning>
106
-
CloudFront ignores `CDN-Cache-Control` and `Surrogate-Control` — only the standard `Cache-Control` header is read. A custom cache policy with a non-zero default TTL caches responses regardless of Fern's `Cache-Control: max-age=0` directive.
127
+
CloudFront ignores `CDN-Cache-Control` and `Surrogate-Control` — only the standard `Cache-Control` header is read. If you use a custom cache policy instead of `CachingDisabled`, set the default, minimum, and maximum TTL to `0`. A non-zero default TTL caches HTML responses regardless of Fern's `Cache-Control: max-age=0` directive, which can cause stale content and errors.
107
128
</Warning>
108
129
</Accordion>
109
130
@@ -256,8 +277,9 @@ Caddy doesn't cache responses by default, so no extra caching configuration is n
256
277
Run these checks against your live subpath:
257
278
258
279
```bash
259
-
# Check that the page loads and x-fern-host is recognized
260
-
curl -sI https://mydomain.com/docs | head -20
280
+
# Confirm the page returns HTML (not an error or RSC payload)
If `content-type` is `text/x-component` instead of `text/html`, your proxy is forwarding the viewer's `Host` header to Fern's origin. Ensure the `Host` header sent to the origin is `app.buildwithfern.com`.
293
+
270
294
If the `age` header is present and non-zero, your proxy is serving a cached response. Revisit your provider's configuration to ensure HTML caching is disabled.
0 commit comments