# Login (SSO ingeschakeld) werkt niet wanneer Nginx is geconfigureerd voor Discourse

**URL:** https://meta.discourse.org/t/login-sso-enabled-is-not-working-when-nginx-is-configured-in-front-discourse/173362
**Category:** Self-hosting
**Created:** [15 december 2020 om 12:47 UTC](https://meta.discourse.org/t/login-sso-enabled-is-not-working-when-nginx-is-configured-in-front-discourse/173362 "2020-12-15T12:47:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![trying2survive](https://avatars.discourse-cdn.com/v4/letter/t/f0a364/32.png) [@trying2survive](https://meta.discourse.org/u/trying2survive)
#### Post date: [15 december 2020 om 12:47 UTC](https://meta.discourse.org/t/login-sso-enabled-is-not-working-when-nginx-is-configured-in-front-discourse/173362/1 "2020-12-15T12:47:14Z")

</div>

Hello,

When applying Nginx in front of Discourse (Nginx → AWS LB → Discourse container), login is not working at all. It just gets redirected to the Discourse homepage after entering the credentials.

Nginx is configured to redirect http to https. We have certificates in AWS Certificate Manager for our domain and subdomains.

Discourse SAML plugin is installed. We also use SSO via different application and its config is using https. force\_https is enabled in site settings as well.

We can confirm that the SSO application is working but it seems that Discourse authentication stopped working after applying Nginx.

For our forums site (Discourse), Nginx is configured like this:

```plaintext
server {
    server_name [subdomain.domain.com];
    location / {
        resolver [insert.resolver.ip.here] valid=60s;
        if ($http_x_forwarded_proto != "https") {
           rewrite ^(.*)$ https://$server_name$1 permanent;
        }
        proxy_pass [AWS-load-balancer-domain];
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Referer $http_referer;
    }
}

```

This Nginx config is working for other subdomains of our main site.

This is the SSO verbose log and though the only error I see is about `ActionController::RoutingError (No route matches [GET] "/.env")`

[verbose-sso-log.txt](https://meta.discourse.org/uploads/short-url/eOA2fYs7Qla4rwxJifs4is0HPnF.txt) (6.3 KB)
