Nginx shared cache does not respect Cache-Contol due to next.js documentation recomendation. #81320
-
Hello. I create this discussion because I want to help people saving their time. I had an issue with self-hosted next.js + nginx. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The issues was caused by the "recommendations" of the Next.js documentation.
Hope, this will save someone their time. |
Beta Was this translation helpful? Give feedback.
The issues was caused by the "recommendations" of the Next.js documentation.
Here is the link: https://nextjs.org/docs/app/guides/self-hosting#streaming-and-suspense .
It suggested to add header that will disable Nginx buffering to make Next.js streaming work.
But it gave much more issues and performance degradation than fixed. Every resource server from Next.js upstream server was not cached by proxy at all.
To fix that all I need is to remove the following header from my
next.config.js
.