revalidatePath with /pages router and SSR
Unanswered
Eloy posted this in #help-forum
![Avatar](https://cdn.discordapp.com/avatars/140561576494104576/a7864a51ca5f46068d907c2aff6baf22.webp?size=256)
EloyOP
Does this work?
I have a dynamic SSR page (getServerSideProps) that cannot be converted into SSG or ISR. I'm on NextJS 12 hosted on Vercel, using the /pages router.
I want to start caching said page, something like "guides/[guide]", and was wondering if revalidatePath works in this environment or if it only works for /app directory.
Thanks!
I have a dynamic SSR page (getServerSideProps) that cannot be converted into SSG or ISR. I'm on NextJS 12 hosted on Vercel, using the /pages router.
I want to start caching said page, something like "guides/[guide]", and was wondering if revalidatePath works in this environment or if it only works for /app directory.
Thanks!
6 Replies
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/44415017de6fed2ccd5d44b4b2051ac0.webp?size=256)
joulev
I don’t think revalidatePath works there, but you have res.revalidate() in pages router api routes
![Avatar](https://cdn.discordapp.com/avatars/140561576494104576/a7864a51ca5f46068d907c2aff6baf22.webp?size=256)
EloyOP
Interesting! I will try it out, thanks
Since it's in the docs under ISR I thought it only would apply there, but taking a closer look maybe it will work with SSR too.
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/44415017de6fed2ccd5d44b4b2051ac0.webp?size=256)
joulev
Eh, no it wont work for SSR. In the pages router there are no caching for dynamically rendered pages at all, and if you introduce custom caching techniques you need to manually implement caching invalidation yourself
![Avatar](https://cdn.discordapp.com/avatars/140561576494104576/a7864a51ca5f46068d907c2aff6baf22.webp?size=256)
EloyOP
Oh so if I set the Cache-Control header for that page (/guides/[guide]), there is no built-in way of invalidating it when, for example, someone performs an edit action?