The new experimental feature of rewrites messes up on iOS devices.
Given this rewrite domain.tld/a to other.tld/path/to.
If consumed with a laptop, Android, _et altri_ it redirects correctly.
If consumed with iOS (iPhone/iPad) it redirects to domain.tld/path/to (mixes the domain and pathname).
It should redirect properly regarding the OS.
I assume this has something to do with Vercel's machinery because it works great in yarn dev and yarn start. It only goes crazy when deployed.
Hi, this appears to be due to the handling of the resource you are rewriting to and not from the rewrites feature itself. You are rewriting to Spotify which attempts to handle the link differently on iOS in production.
This should be a redirect instead of a rewrite to ensure the resource you are pointing the user to can work as expected.
I'm going to close this since it doesn't appear to be a bug in Next.js/Vercel, if this seems incorrect feel free to reply with additional info and we can look into it further
I see what you mean @ijjk
Thanks for the analysis and reply.
I understand the issue is closed now, but may I ask if there's any way to do the redirect within the context of Vercel nextjs/now?馃
Ty again
@sospedra you can create a redirect in a similar way to how you are adding the rewrites in your next.config.js e.g.
module.exports = {
experimental: {
async redirects() {
return [
{
source: '/r/rjpr',
destination: 'https://open.spotify.com/playlist/26NYRcXPyIVrItOtlJ5ahO',
permanent: false
}
]
}
}
}
Damn boy! Didn't know about rewrites/redirects
Super appreciated @ijjk that works like a charm 鈽猴笍
Most helpful comment
@sospedra you can create a redirect in a similar way to how you are adding the rewrites in your
next.config.jse.g.