File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -126,8 +126,14 @@ export const buildResponse = async ({
126126 const relativeUrl = relativizeURL ( rewrite , request . url )
127127 const originalPath = new URL ( request . url , `http://n` ) . pathname
128128
129+ if ( isDataReq ) {
130+ // Data requests might be rewritten to an external URL
131+ // This header tells the client router the redirect target, and if it's external then it will do a full navigation
132+
133+ res . headers . set ( 'x-nextjs-rewrite' , relativeUrl )
134+ }
135+
129136 if ( rewriteUrl . origin !== baseUrl . origin ) {
130- // Netlify Edge Functions don't support proxying to external domains, but Next middleware does
131137 logger . withFields ( { rewrite_url : rewrite } ) . debug ( 'Rewriting to external url' )
132138 let proxyRequest : Request
133139
@@ -151,12 +157,9 @@ export const buildResponse = async ({
151157 }
152158 return addMiddlewareHeaders ( fetch ( proxyRequest ) , res )
153159 } else if ( isDataReq ) {
154- // Data requests might be rewritten to an external URL
155- // This header tells the client router the redirect target, and if it's external then it will do a full navigation
156- res . headers . set ( 'x-nextjs-rewrite' , relativeUrl )
157160 rewriteUrl . pathname = rewriteDataPath ( {
158161 dataUrl : originalPath ,
159- newRoute : relativeUrl ,
162+ newRoute : rewriteUrl . pathname ,
160163 basePath : nextConfig ?. basePath ,
161164 } )
162165 }
Original file line number Diff line number Diff line change 152152 },
153153 "test/e2e/app-dir/actions/app-action.test.ts" : {
154154 "flakey" : [
155- " app-dir action handling should log a warning when a server action is not found but an id is provided"
155+ " app-dir action handling should log a warning when a server action is not found but an id is provided" ,
156+ " app-dir action handling should work with interception routes"
156157 ]
157158 }
158159 },
You can’t perform that action at this time.
0 commit comments