Redirect to base domain from subdomain
Unanswered
Masai Lion posted this in #help-forum
Masai LionOP
Is there a way to use middleware's NextResponse.redirect to redirect from sub.domain.com -> domain.com?
It seems to set the Location as just the path, but not the URL without the subdomain.
The only hack I have found that works is redirecting from sub.domain.com -> www.domain.com and taking advantage of Vercel redirect.
This was asked in #discussions, but I don't see any solutions:
https://discord.com/channels/752553802359505017/752647196419031042/1122165151047614544
I tried to add console logs to BaseNextResponse to try and understand if this is a Next.js or a browser issue, but I couldn't get it to work. Might need to try more.
It seems to set the Location as just the path, but not the URL without the subdomain.
The only hack I have found that works is redirecting from sub.domain.com -> www.domain.com and taking advantage of Vercel redirect.
This was asked in #discussions, but I don't see any solutions:
https://discord.com/channels/752553802359505017/752647196419031042/1122165151047614544
I tried to add console logs to BaseNextResponse to try and understand if this is a Next.js or a browser issue, but I couldn't get it to work. Might need to try more.