2016-12-15 106 views
0

我使用HTTP認證在gerrit安裝時遇到問題。Gerrit與Apache2 - 當HTTP請求轉發請求到Gerrit代碼審查時,HTTP服務器在Authorization標頭中沒有提供用戶名

這是我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

我按照其他教程和解決方案類似的問題,但沒有結果。在端口9091

+0

那麼您如何訪問Gerrit?應該通過端口9091 – StephenKing

回答

0

Apache的工作,格里特在canonicalWebUrl = http://127.0.0.1:9091/(Apache和格里特必須diferent端口工作)

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

嘗試使用 canonicalWebUrl = http://127.0.0.1:9090/

+0

我已經將所有IP從127.0.0.1更改爲IP從本地網絡,它現在可以工作,謝謝。 – Nequeq

+0

你是否改變了端口(從canonicalWebUrl = http://127.0.0.1:9091/到canonicalWebUrl = http://127.0.0.1:9090/)?如果你發佈你的設置,它會爲其他人提供更多信息。請讓你的答案,這將是有趣的。 –

+0

因此,現在我的apache正在偵聽端口80並重定向到ProxyPass/https://192.168.0.185:8080/。 CanonicalWebUrl是http://192.168.0.185:80,我可以通過192.168.0.185:80訪問gerrit。 Gerrit配置中的ListenUrl更改爲http:// *:8080。 – Nequeq