# Nginx and Discourse is redirect looping with SSL

**URL:** <https://meta.discourse.org/t/nginx-and-discourse-is-redirect-looping-with-ssl/50048>\
**Category:** Self-hosting\
**Created:** [September 12, 2016, 11:43pm UTC](https://meta.discourse.org/t/nginx-and-discourse-is-redirect-looping-with-ssl/50048 "2016-09-12T23:43:34Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Semaphorism](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/semaphorism/32/61600_2.png) [@Semaphorism](https://meta.discourse.org/u/Semaphorism)\
**Post date:** [September 12, 2016, 11:43pm UTC](https://meta.discourse.org/t/nginx-and-discourse-is-redirect-looping-with-ssl/50048/1 "2016-09-12T23:43:34Z")

</div>

I have Discourse on port 5001 (HTTP), and 5002 (HTTPS), but the problem is that its redirect looping, also known as ERR\_TOO\_MANY\_REDIRECTS on Chrome.

My Nginx configuration, with SSL. I got this configuration from DigitalOcean, specifically [this article](https://www.digitalocean.com/community/tutorials/how-to-install-discourse-behind-nginx-on-ubuntu-14-04)  
I changed the SSL certificates, as well as the domain, and the port that I use. The configuration is using Lets Encrypt.

(I replaced the real domain with [example.com](http://example.com))

```yaml
server {
        listen 80;
        server_name example.com;
        return 301 https://example.com$request_uri;
}
server {
        listen 443 ssl spdy; 
        server_name example.com;
        ssl_certificate ***** ;
        ssl_certificate_key ***** ;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
        ssl_prefer_server_ciphers on;
        location / {
                proxy_pass http://example.com:5001/;
                proxy_read_timeout 90;
                proxy_redirect http://example.com:5001/ https://example.com;
        }
}

```

Help appreciated, I am not sure if I should enable SSL on discourse or not, but I would assume so.

---

_[View the full topic](https://meta.discourse.org/t/nginx-and-discourse-is-redirect-looping-with-ssl/50048)._
