Replies: 3 comments 3 replies
-
This is currently only supported when deploying to Vercel. We cannot blindly trust request headers. Vercel overrides the correct ones in their proxy so it's safe to rely on it. Other proxies might not do that so we have to be careful and let the user be intentional about trusting headers. An environment variable or other methods are necessary. Currently we detect if See: next-auth/packages/next-auth/src/next/utils.ts Lines 18 to 23 in 8b6d2e3 |
Beta Was this translation helpful? Give feedback.
-
anything? :-( |
Beta Was this translation helpful? Give feedback.
-
Funnily enough the solution to the problem if you don't know the host in advance, or if it changes ports (for always on deployments for instance) is to just set The worst part of it for me is that setting it to |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description 📓
Setting the NEXTAUTH_URL environment variable seems unnecessary in certain environments. For example, when running a next app on google cloud run, the URL of the application is only available after the first deployment. Therefore, to create preview deployments, one needs to deploy an application twice. First, without the URL env, and after the url is available, a second time with the NEXTAUTH url var set.
As I'm aware of, other frameworks like ASP.Net do calculate the current host based on the incoming request. Would it be possible to do the same for next auth as well?
The calculation of ASP.net even works with proxies since the framework does respect X-Forwarded-For headers.
Then, one could remove the need of this variable altogether or just use it to overwrite the calculation for good.
How to reproduce ☕️
Create a nextjs app with next auth (let's say a google login), and try to deploy it on google cloud run.
Contributing 🙌🏽
No, I am afraid I cannot help regarding this
Beta Was this translation helpful? Give feedback.
All reactions