I have this rewrite in next.config.js:
async rewrites() {
return [
{
source: 'https://:postOrProgramId*.tikex-dev.com/',
destination: 'https://tikex-dev.com/:postOrProgramId*',
},
]
},
But it does not work.
I would do rewrite like this amazing-campaign-in-nyc.tikex-dev.com -> tikex-dev.com/amazing-campaign-in-nyc
Unfortunatelly when I run locally, I got this error, though I know it does not support localhost now.
`source` does not start with / for route {"source":"https://:postOrProgramId*.tikex-dev.com/","destination":"https://tikex-dev.com/:postOrProgramId*"}
Yes, source does not starts with / as I would expect first the protocol and then subdomain name comes. Is protocol + subdomain name not part of the source?
I am not sure, I need : before the variable and * after it? How can I express subdomain to subpath redirect?
I have an other reverseproxy rewrite. Do I have to worry about the two will interfere?
{
source: '/api/:path*',
destination: `${
true
? `https://api.tikex-${
process.env.NEXT_PUBLIC_ENVIRONMENT ?? 'dev'
}.com/`
: 'http://localhost:8080/'
}:path*`,
},