【问题标题】:Gerrit with Apache2 - The HTTP server did not provide the username in the Authorization header when it forwarded the request to Gerrit Code ReviewGerrit with Apache2 - HTTP 服务器在将请求转发到 Gerrit Code Review 时未在 Authorization 标头中提供用户名
【发布时间】:2016-12-15 20:52:59
【问题描述】:

我在使用 HTTP auth 安装 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 上的虚拟主机配置:

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

我已经关注了其他类似问题的教程和解决方案,但没有结果。

【问题讨论】:

  • 那你如何访问 Gerrit 呢?应该通过端口 9091

标签: apache authentication configuration gerrit


【解决方案1】:

您的 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/

【讨论】:

  • 我已将所有 IP 从 127.0.0.1 更改为来自本地网络的 IP,现在可以使用了,谢谢。
  • 您是否更改了端口(从 canonicalWebUrl = 127.0.0.1:9091 到 canonicalWebUrl = 127.0.0.1:9090)?如果您发布您的设置,它会为其他人提供更多信息。请做出你的回答,这会很有趣。
  • 所以,现在我的 apache 正在监听端口 80 并重定向到 ProxyPass / 192.168.0.185:8080。 CanonicalWebUrl 是192.168.0.185:80,我可以通过 192.168.0.185:80 访问 gerrit。 gerrit 配置中的 ListenUrl 更改为 http://*:8080。
猜你喜欢
  • 2012-01-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-30
  • 2018-11-07
  • 1970-01-01
相关资源
最近更新 更多