Gerrit with Apache2 - HTTP服务器在将请求转发给Gerrit Code Review时未在Authorization标头中提供用户名

时间:2016-12-15 20:53:00

标签: apache authentication configuration gerrit

我使用HTTP身份验证进行gerrit安装问题。

这是我的gerrit.config:

[gerrit]
    basePath = git
    serverId = fee746a4-35f5-43e5-a39f-e2e77ce5bd7c
    canonicalWebUrl = http://127.0.0.1:9091/
[database]
    type = h2
    database = /home/mapa/gerrit_example/db/ReviewDB
[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://*:9090/
[cache]
    directory = cache

和apache上的virtualhost配置:

Listen 9091
<VirtualHost *:9091>
    ServerName 127.0.0.1
    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 /media/sf_shared/.htpasswd
        Require valid-user
    </Location>
    AllowEncodedSlashes On
    ProxyPass / http://127.0.0.1:9090/
</VirtualHost>

我得到的只是 result

我已经针对类似问题采用了其他教程和解决方案,但没有结果。

1 个答案:

答案 0 :(得分:0)

您的Apache在端口9091上运行,而gerrit在canonicalWebUrl = http://127.0.0.1:9091/上(Apache和gerrit必须在不同的端口上工作)

您的Apache重定向到ProxyPass / http://127.0.0.1:9090/

尝试使用 canonicalWebUrl = http://127.0.0.1:9090/