File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
packages/open-next/src/overrides/wrappers Expand file tree Collapse file tree 1 file changed +6
-0
lines changed 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