burhan-syed / troddit

A web client for Reddit with authenticated logins and a variety of browsing options
https://www.troddit.com
GNU Affero General Public License v3.0
551 stars 80 forks source link

Issues with hosting behind an nginx proxy #152

Closed svilenmarkov closed 1 year ago

svilenmarkov commented 1 year ago

I've tried a bunch of env values but they each lead to different issues. With:

(I've excluded the irrelevant ones regarding secrets but they are set)

REDDIT_REDIRECT=http://my-domain.com/api/auth/callback/reddit
NEXTAUTH_URL=http://localhost:3000

Everything works fine except logging in. The redirect_uri query parameter which gets sent for authentication to reddit is the localhost:3000 one instead of the domain.

If I set the NEXTAUTH_URL to https://my-domain.com

Then the home page doesn't even load at all and there's log errors about not being able to reach /api/auth/session on that domain, however I tried accessing it myself and it worked fine. Any ideas?

EDIT:

Turned out to be an issue on my end, caused by a firewall misconfiguration. The correct configuration would be to use the domain in NEXTAUTH_URL, just have to make sure the container can actually access it.