Discouse passes localhost uri as oauth redirect_uri

I’ve set up what should be a vanilla Docker-based Discourse install (except that I’ve imported an existing database from another, non-Docker install). Things mostly work, but OAuth via github (as well as twitter) fails with a message=redirect_uri_mismatch error. Inspecting the actual packets that are being sent over, I see this in the url:

redirect_uri=http%3A%2F%2Flocalhost%3A6080%2Fauth%2Fgithub%2Fcallback

So that explains that error message. What can I do to make Discourse use its real url (discuss.codemirror.net in this case)?

Edit: Forgot to mention, the container isn’t directly binding port 80/443, but being proxied through an nginx, since the host serves other sites as well.

What is your container config?

1 Like

Did you forget this part of the nginx config?

4 Likes

Thanks! I was missing the extra nginx config lines, adding those solved the issue.

4 Likes