Is there a way to preserve ?_rsc query params on redirection with ISR on app router? (because Missing ?_rsc params cause CDN issue) #65783
Unanswered
zecka
asked this question in
App Router
Replies: 1 comment 2 replies
-
I had encounted the same issue. But i only use the step1. Step 1. remove all internal redirect ( triggered by user click) Below you can have a try. Step2. delete loading.js (DO NOT use streaming render - always 200 http status code) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use redirection in some pages with
import { permanentRedirect } from 'next/navigation';
Once the website is build redirection work well but cause issue with CDN caching because of missing ?_rsc query params. (In my case CDN is Azure front door)
For example i have following redirection
website.com/news/my-article-old-url --> website.com/news/my-article-new-url
On prefetch or on router page change nextjs execute following request
website.com/news/my-article-old-url?_rsc=hash
with a header request Rsc=1.This request is redirect from
website.com/news/my-article-old-url?_rsc=hash
towebsite.com/news/my-article-new-url
and then CDN cache the rsc result as page result, so if we reload the page website.com/news/my-article-new-url we got json like response instead of html.I already try to intercept request with header Rsc=1 and without queryParams ?_rsc on middleware to add response header Cache-Control: no-cache. But _rsc query params and rsc header is always null on middleware...
Beta Was this translation helpful? Give feedback.
All reactions