redirect to the external url from the server
Unanswered
California Gull posted this in #help-forum
California GullOP
I'm trying to redirect the user to the external url from the server but the browser url doesn't change although I can see in the browser devtool that the redirect url status is 200 but the content and url didn't change? Is it because I'm using the fetch API?
So here's the flow.
Fetch => nextjs server => external server
What I would like to do is to redirect the user from nextjs server because I want to add some headers before redirecting to the external url.
I think it could be possible to redirect from nextjs action but not sure.
I used the following code in the server
So here's the flow.
Fetch => nextjs server => external server
What I would like to do is to redirect the user from nextjs server because I want to add some headers before redirecting to the external url.
I think it could be possible to redirect from nextjs action but not sure.
I used the following code in the server
res.setHeader('secret-header', 'some secret')
res.redirect(307, 'https://example.com')
res.writeHead(307, {Location: 'https://example.com'})
res.end()1 Reply
California GullOP
Bump