Discouse passes localhost uri as oauth redirect_uri


(Marijn Haverbeke) #1

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.


(Sam Saffron) #2

What is your container config?


(Kane York) #3

Did you forget this part of the nginx config?


Login via twitter/fb/google always uses "localhost:6000"
(Marijn Haverbeke) #4

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


(Régis Hanol) #5