My gerrit is configured with http authentication behind the apache server, and the
http://exmpale.gerrit.com website can be accessed normally by inputting the user name and password.
Since that I want to deploy my gerrit server in the public network, the anonymous user is disallowed to access by remove the anonymous from the "refs/* read" in gerrit.
Cloning into 'mobileapp'...
remote: Unauthorized
After googling it might be the authentication info doesn't be bypassed to gerrit from apache, I modify the apache configuration as bellow, but it still failed.
Could someone help with it if there is something wrong ? Many thanks in advanced.
<VirtualHost *:80>
ServerName localhost
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location "/">
AuthType Basic
AuthName "Gerrit Code Review"
AuthBasicProvider file
Require valid-user
AuthUserFile /var/gerrit/private/gerrit.passwords
RewriteEngine on
RewriteCond %{REMOTE_USER} (.*)
RewriteRule .* - [E=ENV_REMOTE_USER:%1]
RequestHeader set X-Proxy\_REMOTE-USER %{ENV_REMOTE_USER}e
</Location>
AllowEncodedSlashes on
</VirtualHost>