# Discouse passes localhost uri as oauth redirect\_uri

**URL:** https://meta.discourse.org/t/discouse-passes-localhost-uri-as-oauth-redirect-uri/32905
**Category:** Support
**Created:** [04.Сентябрь.2015 12:06:53 UTC](https://meta.discourse.org/t/discouse-passes-localhost-uri-as-oauth-redirect-uri/32905 "2015-09-04T12:06:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![marijn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marijn/32/115107_2.png) [@marijn](https://meta.discourse.org/u/marijn)
#### Post date: [04.Сентябрь.2015 12:06:53 UTC](https://meta.discourse.org/t/discouse-passes-localhost-uri-as-oauth-redirect-uri/32905/1 "2015-09-04T12:06:53Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [04.Сентябрь.2015 22:04:44 UTC](https://meta.discourse.org/t/discouse-passes-localhost-uri-as-oauth-redirect-uri/32905/2 "2015-09-04T22:04:44Z")

</div>

What is your container config?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [04.Сентябрь.2015 22:41:47 UTC](https://meta.discourse.org/t/discouse-passes-localhost-uri-as-oauth-redirect-uri/32905/3 "2015-09-04T22:41:47Z")

</div>

> [@marijn](#):
>
> 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.

Did you forget this part of the nginx config?

> [@Run other websites on the same machine as Discourse](https://meta.discourse.org/t/run-other-websites-on-the-same-machine-as-discourse/17247/1):
>
> proxy\_pass [http://unix](http://unix):/var/discourse/shared/standalone/nginx.http.sock:;  
> proxy\_set\_header Host $http\_host;  
> proxy\_http\_version 1.1;  
> proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
> proxy\_set\_header X-Forwarded-Proto $proto;  
> }

---

<div class="post-metadata">

### Author: ![marijn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marijn/32/115107_2.png) [@marijn](https://meta.discourse.org/u/marijn)
#### Post date: [05.Сентябрь.2015 15:20:37 UTC](https://meta.discourse.org/t/discouse-passes-localhost-uri-as-oauth-redirect-uri/32905/4 "2015-09-05T15:20:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [07.Сентябрь.2015 07:13:05 UTC](https://meta.discourse.org/t/discouse-passes-localhost-uri-as-oauth-redirect-uri/32905/5 "2015-09-07T07:13:05Z")

</div>


