I cannot figure out how to retrieve the original URL request from a Next.js redirect. Actually the code works as expected on my local server, but the information disappear on production.
My next.config.ts
includes:
{
source: '/user/:path*',
destination: '/api/forward/forward',
permanent: true,
}
While running on local I have the following:
...
'postman-token': '4d592b2f-a759-415c-a775-14e838f25d1e',
'accept-encoding': 'gzip, deflate, br',
connection: 'keep-alive',
'content-length': '3',
referer: 'http://localhost:3000/user/5f8d46425afbfe125bc0277c/balances/2970022',
host: 'localhost:3000'
...
So everything is good here, I can use the referer.
Unfortunately, I cannot retrieve the original URL from the request in production; the only thing I get is:
{
accept: 'application/json',
authorization: 'bearer XXXXX',
'client-id': 'YYYYY',
'content-type': 'application/json',
'content-length': '147',
host: 'www.CCC.com',
'accept-encoding': 'gzip',
'user-agent': 'okhttp/4.9.1',
'x-forwarded-proto': 'https',
'x-forwarded-port': '443',
'x-forwarded-for': '176.145.84.153',
forwarded: 'proto=https;for=176.145.XX.XXX:2112;by=185.42.XXX.XXX',
'sozu-id': '...'
}
I would really appreciate if someone know how I can get the initial URL in order to forward properly.