an hour ago
I have a NextJS app with some static pages behind a Caddy Reverse Proxy. The Reverse proxy is to route traffic from various routes to other services without managing CORS and cross-origin cookie headaces.
I have HTML caching set to never (deployments to the public site don't automatically trigger a restart of the router) however it seems to still be randomly caching pre-rendered "static" NextJS pages until I manually bust the cache... (as determined by the x-cache: HIT header)
2 Replies
an hour ago
Your router service has CDN caching on with HTML Caching set to Never, and in that mode the edge doesn't cache HTML responses, whatever headers your app sends. Purge on deploy is set to HTML, but it only runs when the router itself deploys, so deploys to the services behind Caddy don't clear the router's cache.
The edge decides what counts as HTML from the response Content-Type, not the URL. Responses with a non-HTML content type can still be cached when they come with a Cache-Control max-age or s-maxage.
To work out which case this is, please share the full response headers from one of the x-cache: HIT responses with any secrets removed, including Content-Type, Cache-Control, age and Vary, along with the request path and roughly when you saw it in UTC.
Status changed to Awaiting User Response Railway • about 1 hour ago
Railway
Your router service has CDN caching on with HTML Caching set to Never, and in that mode the edge doesn't cache HTML responses, whatever headers your app sends. Purge on deploy is set to HTML, but it only runs when the router itself deploys, so deploys to the services behind Caddy don't clear the router's cache. The edge decides what counts as HTML from the response `Content-Type`, not the URL. Responses with a non-HTML content type can still be cached when they come with a `Cache-Control` `max-age` or `s-maxage`. To work out which case this is, please share the full response headers from one of the `x-cache: HIT` responses with any secrets removed, including `Content-Type`, `Cache-Control`, `age` and `Vary`, along with the request path and roughly when you saw it in UTC.
an hour ago
UPDATE: Just had a bot determine that the issue was pages that where cached before the setting change where not purged when the setting was updated. After the Purge all pages seem to be giving x-cache: DYNAMIC reliably.
Also If anyone reads this.... Guys that message above is pure AI hallucinagenic slop that is asking things fully answered in the question. Why are you doing things like that?
Status changed to Awaiting Railway Response Railway • about 1 hour ago
Status changed to Solved Railway • about 1 hour ago