File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
packages/open-next/src/overrides Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,6 @@ const converter: Converter = {
3131 ) ;
3232 const query = getQueryFromSearchParams ( url . searchParams ) ;
3333
34- if ( req . protocol === "http" && url . hostname === "localhost" ) {
35- // This is used internally by Next.js during redirects in server actions. We need to set it to the origin of the request.
36- process . env . __NEXT_PRIVATE_ORIGIN = url . origin ;
37- // This is to make `next-auth` and other libraries that rely on this header to work locally out of the box.
38- headers [ "x-forwarded-proto" ] = req . protocol ;
39- }
40-
4134 return {
4235 type : "core" ,
4336 method : req . method ?? "GET" ,
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ const wrapper: WrapperHandler = async (handler, converter) => {
3434 } ) ;
3535
3636 app . all ( "*paths" , async ( req , res ) => {
37+ if ( req . protocol === "http" && req . hostname === "localhost" ) {
38+ // This is used internally by Next.js during redirects in server actions. We need to set it to the origin of the request.
39+ process . env . __NEXT_PRIVATE_ORIGIN = `${ req . protocol } ://${ req . hostname } ` ;
40+ // This is to make `next-auth` and other libraries that rely on this header to work locally out of the box.
41+ req . headers [ "x-forwarded-proto" ] = req . protocol ;
42+ }
3743 const internalEvent = await converter . convertFrom ( req ) ;
3844 const streamCreator : StreamCreator = {
3945 writeHeaders : ( prelude ) => {
You can’t perform that action at this time.
0 commit comments