File tree 2 files changed +10
-7
lines changed
packages/open-next/src/adapters/routing
2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " open-next " : patch
3
+ ---
4
+
5
+ fix: prevent duplication of location header
Original file line number Diff line number Diff line change @@ -123,18 +123,16 @@ export async function handleMiddleware(
123
123
// If the middleware returned a Redirect, we set the `Location` header with
124
124
// the redirected url and end the response.
125
125
if ( res . statusCode >= 300 && res . statusCode < 400 ) {
126
- const location = result . response . headers
127
- . get ( "location" )
128
- ?. replace ( "http://localhost:3000" , `https://${ req . headers . host } ` ) ;
126
+ resHeaders . location = resHeaders . location ?. replace (
127
+ "http://localhost:3000" ,
128
+ `https://${ req . headers . host } ` ,
129
+ ) ;
129
130
// res.setHeader("Location", location);
130
131
return {
131
132
body : "" ,
132
133
type : internalEvent . type ,
133
134
statusCode : res . statusCode ,
134
- headers : {
135
- ...resHeaders ,
136
- Location : location ?? "" ,
137
- } ,
135
+ headers : resHeaders ,
138
136
isBase64Encoded : false ,
139
137
} ;
140
138
}
You can’t perform that action at this time.
0 commit comments