Replies: 16 comments 8 replies
-
I guess you can use Nginx and proxy pass calls to 3000
So every call to localhost:8080/* will be proxied. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the suggestion @jsphkhan , the issue I'm having is that the next-auth is redirecting to the SITE port :3000 but I need it to redirect back to the proxy port. When I set the SITE to the proxy, the next-auth seems to fail via CONNECTION REFUSED. |
Beta Was this translation helpful? Give feedback.
-
@khuezy Aah, ok got it. I will give that a try and let you know... |
Beta Was this translation helpful? Give feedback.
-
If the proxy URL is valid (e.g. Can you give examples of what your production URLs look like and an idea what the proxy config does? I assume you are not running URLs like |
Beta Was this translation helpful? Give feedback.
-
@iaincollins My proxy setup running on PORT 8000: When I set the SITE to 8000, next-auth has issues connecting to |
Beta Was this translation helpful? Give feedback.
-
You should also be able to get a response from
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Ah, so if it's running in a Docker container then |
Beta Was this translation helpful? Give feedback.
-
You're correct. From the perspective of the next-auth One way around this is to set the |
Beta Was this translation helpful? Give feedback.
-
I was trying to think of practical ways to work around this; that sounds like a good idea! |
Beta Was this translation helpful? Give feedback.
-
So I am having an issue similar to this. I have it running in a docker container (port 8003, which forwards to 3000). Everything seems to forward correctly, except when I try and go to /api-example - there seems to be an error with getSession...I get null returned. If I go to /api/auth/session directly I get the correct info back. When I look at the logs for the container when I go to api-example I see: Similar to this, is there a way to customize what the session contains? By default it has the user (name, email, image), token, expiration. But I am not using name (I've customized this in my model - which is working), and I'd like to update that in the session data. Thanks. I have also notice that if I use the nextauth_url as localhost:3000 it works in the docker container, but if I use a domain everything seems to work except this (including it registering that I'm still signed in). |
Beta Was this translation helpful? Give feedback.
-
related: #676 |
Beta Was this translation helpful? Give feedback.
-
Hi there! It looks like this issue hasn't had any activity for a while. It will be closed if no further activity occurs. If you think your issue is still relevant, feel free to comment on it to keep ot open. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I ran into this running in I fixed this by setting the internal port that next runs on to the same as the external port it's mapped to, and using the internal server host:port for my auth service. In particular, I'm using Hope that helps! I'll note that, between this frustration and the general lack of sane defaults for a lot of things/generally unfavorable developer experience, we've decided to switch back to Auth0. |
Beta Was this translation helpful? Give feedback.
-
In my case using NEXTAUTH_URL INTERNAL solved the issue. |
Beta Was this translation helpful? Give feedback.
-
Using a proxy with TUN mode works for me, e.g. https://github.com/clash-verge-rev/clash-verge-rev 有人接入 Google 登录一直失败的话,可以试一下 Clash Verge 的 TUN 模式。 |
Beta Was this translation helpful? Give feedback.
-
Please refer to the documentation, the example project and existing issues before creating a new issue.
Your question
Hi, is it possible to run next-auth behind a proxy app?
What are you trying to do
I have the nextjs app running on :3000 and it sits behind a proxy on :8000.
I would like the /api/auth callback to redirect to the proxy:8000 instead of :3000.
Documentation feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions