Gitlab:登录导致无限重定向循环

Gitlab:登录导致无限重定向循环

从昨天起,我就一直尝试在我的家庭服务器上安装 Gitlab,但到目前为止,我还没有成功让它运行 :(

我使用 Gitlab 站点提供的软件包在 Ubuntu 14.04 上安装了它:https://about.gitlab.com/downloads/#ubuntu1404

然后我将其配置为使用外部域https://gitlab.example.com(出于安全原因而更改)并且我想使用带有 SSL 的反向代理通过 Apache 来代理它。

到目前为止,我可以看到登录页面并浏览,但当我尝试使用默认用户名和密码登录时,我最终陷入了无限的重定向循环,我找不到原因。到目前为止,我尝试了找到的所有解决方案,但没有一个对我有用。

我做了一些改变/etc/gitlab/gitlab.rb

external_url 'https://gitlab.example.com'
unicorn['port'] = 8890 # needed, since the port 8080 was already in use
nginx['listen_addresses'] = ['*']
nginx['listen_port'] = 8888
nginx['listen_https'] = false

我的 Apache 2.4 vHost 配置如下:

<VirtualHost *:80>
  ServerName gitlab.example.com

  ErrorLog /var/log/apache2/gitlab.example.com-error.log

  Redirect / https://gitlab.example.com/
</VirtualHost>

<VirtualHost *:443>
  ServerName gitlab.example.com

  ErrorLog /var/log/apache2/gitlab.example.com-error.log

  RequestHeader set Host "gitlab.example.com"
  RequestHeader add X-Forwarded-Ssl on
  RequestHeader set X-Forwarded-For %{REMOTE_IP}e
  RequestHeader set X-Forwarded-Proto "https"

  ProxyPreserveHost On
  ProxyPass / http://localhost:8888/
  ProxyPassReverse / http://localhost:8888/

  SSLEngine on
  SSLCertificateKeyFile /etc/apache2/mycert/server.key
  SSLCertificateFile /etc/apache2/mycert/server.crt
</VirtualHost>

并且日志/var/log/gitlab/gitlab-rails/production.log告诉我:

Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 7ms (ActiveRecord: 2.0ms)
Started GET "/" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by RootController#index as HTML
Completed 401 Unauthorized in 7ms (ActiveRecord: 4.3ms)
Started GET "/users/sign_in" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by SessionsController#new as HTML
Redirected to https://gitlab.example.com/
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 6ms (ActiveRecord: 1.8ms)
Started GET "/" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by RootController#index as HTML
Completed 401 Unauthorized in 6ms (ActiveRecord: 2.8ms)
Started GET "/users/sign_in" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by SessionsController#new as HTML
Redirected to https://gitlab.example.com/
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 7ms (ActiveRecord: 2.0ms)
Started GET "/" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by RootController#index as HTML
Completed 401 Unauthorized in 5ms (ActiveRecord: 2.3ms)
Started GET "/users/sign_in" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by SessionsController#new as HTML
Redirected to https://gitlab.example.com/
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 7ms (ActiveRecord: 2.0ms)
Started GET "/" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by RootController#index as HTML
Completed 401 Unauthorized in 6ms (ActiveRecord: 2.8ms)
Started GET "/users/sign_in" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by SessionsController#new as HTML
Redirected to https://gitlab.example.com/
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 7ms (ActiveRecord: 1.9ms)
Started GET "/" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by RootController#index as HTML
Completed 401 Unauthorized in 6ms (ActiveRecord: 2.8ms)
Started GET "/users/sign_in" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by SessionsController#new as HTML
Redirected to https://gitlab.example.com/
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 5ms (ActiveRecord: 0.9ms)
Started GET "/" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by RootController#index as HTML
Completed 401 Unauthorized in 3ms (ActiveRecord: 1.2ms)
Started GET "/users/sign_in" for xxx.xxx.xxx.xxx at 2015-09-24 22:32:40 +0200
Processing by SessionsController#new as HTML
Redirected to https://gitlab.example.com/
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 5ms (ActiveRecord: 1.1ms)

也许你们中有人知道为什么会发生这种情况?

祝好,Benni

相关内容