# Oauth2 redirect\_uri uses HTTP when my forum is using HTTPS

**URL:** <https://meta.discourse.org/t/oauth2-redirect-uri-uses-http-when-my-forum-is-using-https/91789>\
**Category:** SSO\
**Tags:** oauth2\
**Created:** [July 7, 2018, 4:25pm UTC](https://meta.discourse.org/t/oauth2-redirect-uri-uses-http-when-my-forum-is-using-https/91789 "2018-07-07T16:25:45Z")\
**Posts on this page:** 7\
**Page:** 1

## AI-generated summary

The user channing is experiencing an issue with OAuth2 authentication on their Discourse forum, where the `redirect_uri` is using HTTP instead of HTTPS despite the forum being accessible via HTTPS. They initially tried enabling the `force https` setting in Discourse admin settings, but the issue persisted. [itsbhanusharma](/t/-/91789/2) suggested this setting, which [channing](/t/-/91789/1) tested but found ineffective. Channing later discovered that the problem was caused by conflicting Nginx configuration rules from Certbot, which are not fully compatible with Discourse's Docker setup. The issue was resolved by adjusting the Nginx configuration according to [Discourse's guide](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247?u=fefrei).

<div class="post-metadata">

**Author:** ![channing](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/channing/32/125299_2.png) [@channing](https://meta.discourse.org/u/channing)\
**Post date:** [July 7, 2018, 4:25pm UTC](https://meta.discourse.org/t/oauth2-redirect-uri-uses-http-when-my-forum-is-using-https/91789/1 "2018-07-07T16:25:45Z")

</div>

Hi,

I just enabled HTTPS for my Discourse forum (Let’s Encrypt + nginx on _host system_). No redirection was added so visitors can use HTTP or HTTPS. Everything worked as expected.

Then I tried to enable Google Oauth2 authentication. However, I noticed that Discourse called Google Oauth2 with `redirect_uri` set to the HTTP forum URL while the forum was opened with HTTPS.

How can I fix this? My forum is [https://discussion.listary.com/](https://discussion.listary.com/) . Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)\
**Post date:** [July 7, 2018, 4:58pm UTC](https://meta.discourse.org/t/oauth2-redirect-uri-uses-http-when-my-forum-is-using-https/91789/2 "2018-07-07T16:58:02Z")

</div>

Do You have force https enabled?

---

<div class="post-metadata">

**Author:** ![channing](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/channing/32/125299_2.png) [@channing](https://meta.discourse.org/u/channing)\
**Post date:** [July 7, 2018, 6:26pm UTC](https://meta.discourse.org/t/oauth2-redirect-uri-uses-http-when-my-forum-is-using-https/91789/3 "2018-07-07T18:26:29Z")

</div>

No. Is there a Discourse setting for that?

---

<div class="post-metadata">

**Author:** ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)\
**Post date:** [July 7, 2018, 6:27pm UTC](https://meta.discourse.org/t/oauth2-redirect-uri-uses-http-when-my-forum-is-using-https/91789/4 "2018-07-07T18:27:20Z")

</div>

Indeed there is!

In admin \> settings  
Search for `force https` and enable it.

---

<div class="post-metadata">

**Author:** ![channing](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/channing/32/125299_2.png) [@channing](https://meta.discourse.org/u/channing)\
**Post date:** [July 7, 2018, 6:55pm UTC](https://meta.discourse.org/t/oauth2-redirect-uri-uses-http-when-my-forum-is-using-https/91789/5 "2018-07-07T18:55:04Z")

</div>

Just tried that setting. And unfortunately, it’s still the same.

I think Discourse should be able to detect the original protocol automatically. I don’t know why it doesn’t work in my case.

---

<div class="post-metadata">

**Author:** ![channing](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/channing/32/125299_2.png) [@channing](https://meta.discourse.org/u/channing)\
**Post date:** [July 8, 2018, 3:08am UTC](https://meta.discourse.org/t/oauth2-redirect-uri-uses-http-when-my-forum-is-using-https/91789/6 "2018-07-08T03:08:21Z")

</div>

I got it working. I used Certbot to manage Let’s Encrypt on my host system. It turned out that some rules Certbot added to the nginx config file is not fully compaitible with Discourse docker. I fixed it according to [Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247).

---

<div class="post-metadata">

**Author:** ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)\
**Post date:** [July 8, 2018, 4:28am UTC](https://meta.discourse.org/t/oauth2-redirect-uri-uses-http-when-my-forum-is-using-https/91789/7 "2018-07-08T04:28:33Z")

</div>

Closed on July 8, 2018, 4:28am UTC


