As the title suggests - I have a nextjs application that works absolutely fine locally - However, now I've deployed it to a dev environment, something really weird is happening.
I've deployed my application to a dev environment, and set my NEXTAUTH_URL Environment Variable to my development domain dev.mydomain.com. However when I login it redirects me to localhost:3000 . The weird thing is, if I have my local server running, and I change the port it runs on to say :4000, the actual website redirects me to localhost:4000... It's like it knows where my code is running locally with no reference to it?
Does anyone know what's going on here? I'm very confused - There's no reference to localhost in my codebase whatsoever, never mind the specific ports!
Be sure to add NEXTAUTH_URL to your env variable config on your cloud server.
Don't forget to add the site to your configuration of your NextAuth instance because I believe it redirects to localhost:3000 by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With