Configuration Error for http authentication

2,448 views
Skip to first unread message

John

unread,
May 3, 2011, 7:43:19 AM5/3/11
to Repo and Gerrit Discussion
Hi, I was trying to set Gerrit authentication type to http. Here is
my httpd.conf file's content:
NameVirtualHost hostname:8080
<VirtualHost hostname:8080>
ServerName hostname.domain.com

ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On

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

<Location /login/>
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
AuthUserFile /back/passwd
</Location>
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>
And the gerrit.config file:
[gerrit]
basePath = git
[database]
type = H2
database = db/ReviewDB
[auth]
type = HTTP
[container]
user = gerrituser
javaHome = /usr/lib/jvm/java-6-openjdk/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = proxy-http://*:8080/
[cache]
directory = cache
but I get the following error when i visit http://hostname:8080/
"...............................................................error
info.............................................................
Check the HTTP server's authentication settings.
The HTTP server did not provide the username in the Authorization
header when it forwarded the request to Gerrit Code Review.

If the HTTP server is Apache HTTPd, check the proxy configuration
includes an authorization directive with the proper location, ensuring
it ends with '/':

<VirtualHost kona-gerrit:8080>
ServerName kona-gerrit

ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On

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

<Location /login/>
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
...
</Location>
ProxyPass / http://.../
</VirtualHost>
"....................................................................end
of error
info........................................................................

Am I missing something here. Or how should i write the configuration
file?
Thank you!

Shawn Pearce

unread,
May 3, 2011, 11:42:14 AM5/3/11
to John, Repo and Gerrit Discussion
On Tue, May 3, 2011 at 04:43, John <zoume...@gmail.com> wrote:
> Hi, I was trying to set Gerrit authentication type to http.  Here is
> my httpd.conf file's content:
> NameVirtualHost hostname:8080
> <VirtualHost hostname:8080>
...

>    ProxyPass / http://127.0.0.1:8080/

You need to point this to the port Gerrit is running on. 8080 is what
you are running Apache on, or think you are. So this would just
redirect back to Apache, creating an infinite loop. Apache and Gerrit
need to be on separate ports.

>    ProxyPassReverse / http://127.0.0.1:8080/

This line is not necessary.

> And the gerrit.config file:


> [httpd]
>        listenUrl = proxy-http://*:8080/

This port needs to be a different port than the port Apache is using.

John

unread,
May 3, 2011, 9:10:41 PM5/3/11
to Repo and Gerrit Discussion
So I changed "ProxyPass / http://127.0.0.1:8080/" to ProxyPass /
http://127.0.0.1:8081/
and listenUrl = proxy-http://*:8080/ to listenUrl = proxy-http://*:
8081/ and remained else the same.
Then,when I visited hostname:8080, it could not display the page, like
the name was not working. When I visited hostname:8081, it showed the
same error like before("Check the HTTP server's authentication
settings....") .
Anything else should I do?



On May 3, 11:42 pm, Shawn Pearce <s...@google.com> wrote:
> On Tue, May 3, 2011 at 04:43, John <zoumeng...@gmail.com> wrote:
> > Hi, I was trying to set Gerrit authentication type to http.  Here is
> > my httpd.conf file's content:
> > NameVirtualHost hostname:8080
> > <VirtualHost hostname:8080>
> ...
> >    ProxyPass /http://127.0.0.1:8080/
>
> You need to point this to the port Gerrit is running on. 8080 is what
> you are running Apache on, or think you are. So this would just
> redirect back to Apache, creating an infinite loop. Apache and Gerrit
> need to be on separate ports.
>
> >    ProxyPassReverse /http://127.0.0.1:8080/

Shawn Pearce

unread,
May 3, 2011, 9:13:47 PM5/3/11
to John, Repo and Gerrit Discussion
On Tue, May 3, 2011 at 18:10, John <zoume...@gmail.com> wrote:
> So I changed "ProxyPass / http://127.0.0.1:8080/" to ProxyPass /
> http://127.0.0.1:8081/
> and listenUrl = proxy-http://*:8080/ to listenUrl = proxy-http://*:
> 8081/ and remained else the same.
> Then,when I visited hostname:8080, it could not display the page, like
> the name was not working.

Is your Apache server actually listening to port 8080?

John

unread,
May 3, 2011, 9:43:25 PM5/3/11
to Repo and Gerrit Discussion
I don't know. I know little about apache. How to check if it is
listening to port 8080 or not?

On May 4, 9:13 am, Shawn Pearce <s...@google.com> wrote:
> On Tue, May 3, 2011 at 18:10, John <zoumeng...@gmail.com> wrote:
> > So I changed "ProxyPass /http://127.0.0.1:8080/" to ProxyPass /

John

unread,
May 3, 2011, 10:49:01 PM5/3/11
to Repo and Gerrit Discussion
Thank you Shawn! I do not know if my Apache server actually is
listening to port 8080 or not. But I changed hostname:8080 to the ip
address. and then it started working! Thank you!
Reply all
Reply to author
Forward
0 new messages