Unable to log in as admin "unknown error"


#1

I was previously able to log in after a fresh (docker) install but now am getting an “unknown error”. I have tried resetting the admin password with rake admin:create. That command does not return any errors but I am still unable to log in with the admin account.

I have also tried rebuilding and creating a new admin account.
Is there a log that I can look at which will give more information than “unknown error”?

ps. I have tried three different browsers (chromium on two computers and firefox)


#2

A bit more information on this. I am running discourse on port 20081 behind an apache SSL reverse proxy.
It looks like enabling “https” inside discourse may cause some issues with redirection. Investigating…
In the meantime it would be good to know if there’s a way of turning off https from the command line to enable logging in to the instance.


(Jeff Atwood) #3

You need to pass the proper https headers through, otherwise you will have severe problems with secure cookies.


#4

thanks Jeff, I’m wondering what the best way to do this is.
Currently I’m running using the option:

expose:
  - "20080:80"

then I proxy this to https via apache:

<VirtualHost *:80>

...

# REDIRECT TO HTTPS
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

</VirtualHost>

<VirtualHost *:443>
...
ProxyPreserveHost On
        ProxyRequests Off
# discourse forum engine on VM forum
        ProxyPass / http://forum.server:20080/
        ProxyPassReverse / http://forum.server:20080/

        # allow Xframe
        Header always unset X-Frame-Options
        Header set X-Frame-Options "ALLOW-FROM https://server.net"
...

</VirtualHost>

This works well but I am also hoping to embed the forum for commenting on a web site.
As the discourse install is not aware it is being proxied, it continues to make requests to http addresses (eg: http://forum.myserver.net/login).

This results in an insecure “mixed-content” warning in browsers.

However, if I turn on the “https” option in discourse, then I get the “unknown error” on trying to log in. Is there a way to have discourse present https: requests while using an external reverse proxy such as this?


#5

I found that this can be done relatively easily using the apache proxy settings,
the following option needs to be set:

RequestHeader set X-Forwarded-Proto "https" env=HTTPS

(Pad Pors) #6

Hi,

I’m getting the same error but on localhost. does anyone know how to resolve it?

thanks in advance.