No redirect after login, but 'Location: /' is set
Created by: jedix
After manually installing GitLab on Debian 8.0 I get the wrong HTTP response code after login. Everything else seems to work.
Steps to reproduce:
- go to https://www.example.com/users/sign_in
- enter valid credentials and submit the login form
- no redirect happens (HTTP status code: 200) but HTTP header
Location
is set to/
- browser ignores location header because of status code and displays login page again
- enter https://www.example.com/ manually -> you see the dashboard
My setup: Gitlab 7.10 sits behind an apache proxy, I'm using SSL with trusted certificates.
gitlab.yml
gitlab:
host: www.example.com
port: 443
https: true
virtualhost:
Header add Strict-Transport-Security: "max-age=15768000;includeSubdomains"
SSLCompression Off
ServerSignature Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
<Location />
Require all granted
ProxyPassReverse http://127.0.0.1:8080
ProxyPassReverse http://www.example.com/
</Location>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]
RequestHeader set X_FORWARDED_PROTO 'https'
DocumentRoot /home/git/gitlab/public
production.log
Started GET "/users/sign_in" for some-ip at 2015-04-29 11:13:20 +0200
Processing by SessionsController#new as HTML
Completed 200 OK in 20ms (Views: 7.2ms | ActiveRecord: 1.2ms)
Started POST "/users/sign_in" for some-ip at 2015-04-29 11:13:22 +0200
Processing by SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "user"=>{"login"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"0"}}
Completed 200 OK in 117ms (Views: 6.7ms | ActiveRecord: 16.2ms
On my old server, the production log shows 302 instead of 200 and everything works as expected (but this is GitLab 7.4):
Started GET "/users/sign_in" for some-ip at 2015-04-29 10:36:24 +0200
Processing by SessionsController#new as HTML
Completed 200 OK in 149ms (Views: 135.3ms | ActiveRecord: 0.0ms)
Started POST "/users/sign_in" for some-ip at 2015-04-29 10:36:26 +0200
Processing by SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"AQtzko/SFt5kf9UHcxBu+/7OS9Kv0tTpLNZkFiBWLOk=", "user"=>{"login"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"0"}}
Redirected to https://www.example.com/
Completed 302 Found in 233ms (ActiveRecord: 74.6ms)
Started GET "/" for some-ip at 2015-04-29 10:36:26 +0200
Processing by DashboardController#show as HTML
Completed 200 OK in 110ms (Views: 68.9ms | ActiveRecord: 9.0ms)
If more information is needed, I am happy to provide it. The problem does not seem to be the proxy setup because tunneling port 8080 over ssh and resolving the domain to 127.0.0.1 on my local machine also gives no redirect.