Loss of functionality: Ability to set SSR cache-control based on API response #49122
Unanswered
steve-taylor
asked this question in
App Router
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the old router,
getServerSideProps
can be used to setCache-Control
headers based on an API response. It's mentioned in the docs here.It would look something like this:
The important thing here is that we don't know what
s-maxage
will be until we get a response from the API.In the new app router, we can't do this. We need to set
revalidate
ahead of time:And then that
revalidate
value is used as the TTL of the SSR page.Unless there is something I'm missing here, this is functionality that has gone missing in the new app router and the
revalidate
thing onfetch
needs to be thought through properly. Alternatively, there needs to be a dynamic alternative toexport const revalidate = <whatever>;
, e.g.export const async getRevalidate() { /* ... */ }
.Beta Was this translation helpful? Give feedback.
All reactions