Authentication not working after a recent update

I have a Discourse instance that has been working nicely for the past few months, it’s using a standard Docker setup and is behind an Nginx reverse proxy. (hosted here: https://forums.lutris.net/ ). The Docker container doesn’t use SSL, HTTPS is handled by the Nginx reverse proxy with a Let’sEncrypt certificate.

I have recently received complaints from users not being able to log in and after logging out from my account, I’m unable to log in as well. I’ve tried the /users/admin-login method for logging in an admin user but this isn’t working either.
I had suspected that the problem would come from an issue with SSO login, which I have disabled for the time being and the problem persists.

Here’s what shows up in the logs when I try to log in, no errors whatsoever, the user is just being redirected to the home page without being logged in.

Started GET "/session/csrf?_=1477502949683" for 45.50.167.200 at 2016-10-26 17:40:03 +0000
Processing by SessionController#csrf as */*
  Parameters: {"_"=>"1477502949683"}
Completed 200 OK in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms)
Started POST "/session" for 45.50.167.200 at 2016-10-26 17:40:04 +0000
Processing by SessionController#create as */*
  Parameters: {"login"=>"strider", "password"=>"[FILTERED]"}
Completed 200 OK in 283ms (Views: 0.1ms | ActiveRecord: 34.7ms)
Started POST "/login" for 45.50.167.200 at 2016-10-26 17:40:04 +0000
Processing by StaticController#enter as HTML
  Parameters: {"username"=>"strider", "password"=>"[FILTERED]", "redirect"=>"https://forums.lutris.net/"}
Redirected to http://forums.lutris.net/
Completed 302 Found in 2ms (ActiveRecord: 0.0ms)
Started GET "/" for 45.50.167.200 at 2016-10-26 17:40:05 +0000
Processing by ListController#latest as HTML
  Rendered list/list.erb within layouts/application (6.5ms)
  Rendered layouts/_head.html.erb (0.3ms)
  Rendered common/_special_font_face.html.erb (0.2ms)
  Rendered common/_discourse_stylesheet.html.erb (0.1ms)
  Rendered common/_google_universal_analytics.html.erb (0.1ms)
  Rendered application/_header.html.erb (0.1ms)
  Rendered common/_discourse_javascript.html.erb (0.2ms)
Completed 200 OK in 82ms (Views: 10.7ms | ActiveRecord: 15.4ms)

Again, this is a completely new issue. The Discourse instance was working flawlessly a few days ago. I’m running out of ideas of what could be causing this issue and I’m hoping someone here will know :slight_smile:

This happens when the reverse proxy isn’t configured properly.

Please try to add the necessary headers:

4 Likes

I was indeed missing the line

proxy_set_header X-Forwarded-Proto https;

It’s now working again, thanks a lot!!

5 Likes