Gerrit错误日志:"无法通过授权请求标头"对用户进行身份验证。发生了什么事?

时间:2016-03-18 03:38:20

标签: gerrit

我在ubuntu服务器v-12.04上安装了gerrit-v2.11,使用了apache2 do Reverse Proxy。这是我的gerrit.config:

[gerrit]
basePath = git
canonicalWebUrl = http://192.168.26.47:8081
[database]
type = h2
database = db/ReviewDB
[index]
type = LUCENE
[auth]
type = HTTP
[sendemail]  
smtpServer = smtp.exmail.qq.com
smtpServerPort = 465  
smtpEncryption = ssl  
smtpUser = gerrit@pisen.com.cn  
smtpPass = PS1024mail
sslVerify = false  
from=CodeReview<gerrit@pisen.com.cn> 
[container]
user = mng
javaHome = /usr/lib/jvm/jdk1.8.0_65/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = proxy-http://192.168.26.47:8081/
[cache]
directory = cache
[download]
command = checkout
command = cherry_pick
command = pull
command = format_patch
scheme = http
scheme = anon_http
scheme = anon_git
scheme = repo_download
scheme = ssh

和apache2默认文件:

<VirtualHost *:8080>
    ServerName 192.168.26.47

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>

    <Location /login/>
            AuthType Basic
            AuthName "Gerrit Code Review"
            AuthBasicProvider file
            AuthUserFile /adm-servers/gerrit/review_site/etc/passwords
            Require valid-user
    </Location>

AllowEncodedSlashes On
    ProxyPass / http://192.168.26.47:8081/
ProxyPassReverse / http://127.0.0.1:8081/

现在它有效。但是,登录需要很长时间(约1-2分钟): enter image description here

我检查了日志文件,有一个错误:

[2016-03-18 09:51:24,268] INFO  org.eclipse.jetty.server.ServerConnector : Started ServerConnector@5ced0537{HTTP/1.1}{192.168.26.47:8081}
[2016-03-18 09:51:24,268] INFO  org.eclipse.jetty.server.Server : Started @13804ms
[2016-03-18 09:51:24,269] INFO  com.google.gerrit.pgm.Daemon : Gerrit Code Review 2.11 ready
[2016-03-18 10:05:03,957] ERROR com.google.gerrit.httpd.auth.container.HttpLoginServlet : Unable to authenticate user by Authorization request header.  Check container or server configuration.

我搜索了这个错误信息,并被告知最可能的原因是Gerrit和apache使用相同的端口。显然,在我的配置文件中,这些端口彼此并不相同。

我还抓住了这些包裹: enter image description here

捕获谈话,登录时收到的TCP连接。我怀疑错误&#34;无法通过授权请求标头验证用户&#34;导致连接被清除。

任何机构都知道发生了什么&#34;无法通过授权请求标题验证用户&#34;?

1 个答案:

答案 0 :(得分:0)

我现在好,但找不到原因。 我有空的时候会尝试一个新的环境来找到它。 这是我的配置细节(init gerrit-2.12.war到&#39; / usr / local / gerrit&#39;):

vim /etc/apache2/httpd.conf

<VirtualHost [My_IP]:80>
    ServerName [My_IP]

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On
    <Proxy *:80>
          Order deny,allow
          Allow from all
    </Proxy>
    <Location '/login/'>
      AuthType Basic
      AuthName "YuhuiXU Gerrit Code Review"
      Require valid-user
      AuthBasicProvider file
      AuthUserFile  /usr/local/gerrit/etc/passwds
    </Location>
    AllowEncodedSlashes On
    ProxyPass / http://[My_IP]:8081/
</VirtualHost>

vim /usr/local/gerrit/etc/gerrit.config

[gerrit]
    basePath = git
    canonicalWebUrl = http://test026:80/
[database]
    type = mysql
    hostname = localhost
    database = reviewdb
    username = gerrit
[index]
    type = LUCENE
[auth]
    type = HTTP
[receive]
    enableSignedPush = false
[sendemail]
    smtpServer = localhost
[container]
    user = root
    javaHome = /usr/lib/jvm/java-8-openjdk-amd64/jre
[sshd]
    listenAddress = *:29418
[httpd]
    listenUrl = http://[My_IP]:8081/
[cache]
    directory = cache

希望这会对你有所帮助。