Next.js Discord

Discord Forum

Cache on getServerSideProps using s-maxage

Unanswered
rash3r posted this in #help-forum
Open in Discord
Using the pages router, I wanted to set a page to cache on the CDN/reverse proxy (currently using vercel in prod) for N seconds, thus avoiding having to run getServerSideProps for every request made.

However, trying the setup in the screenshot locally, every time I refresh the browser it logs ‘running on server’ on the console, which implies that getServerSideProps is being run, and so the server is not returning the cached page response.

I am using next build and next start, not next dev.

Is the reason for this because there is some configuration issue, or does next start simply not simulate a reverse proxy/ cdn and therefore not take s-maxage into account?

0 Replies