You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Perrin Harkins <pe...@elem.com> on 2007/01/10 01:09:38 UTC
Re: [mp2] Perl Auth Handlers and mod_proxy : losing querystring on
remote server (BUG?)
Does it help any if you use ProxyMatch instead of LocationMatch?
- Perrin
>
Re: [mp2] Perl Auth Handlers and mod_proxy : losing querystring on
remote server (BUG?)
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Geoffrey Young wrote:
>> <LocationMatch /(?i)protected/>
>> AuthType Basic
>> AuthName "Test Authentication"
>> AuthUserFile /www/xperience.ch/conf/.htpasswd
>> require valid-user
>> </LocationMatch>
>
>
> next test -
I won't be able to do any more work tonight, so if this doesn't work
here's what I'd suggest...
are you running any other mod_perl things other than authen? if not,
please take a working .htpasswd config and add in a PerlInitHandler of
any sort - I don't think it could really be authen that's tripping stuff
up, but I know we do some things for proxy requests, so it might be the
mere presence of mod_perl in the mix that is affecting you.
next, I know it's asking a lot, but I doubt anyone will have the free
tuits to create a proxy setup that mimics your problem. however, if you
can create a self-contained test scenario using this
http://people.apache.org/~geoff/bug-reporting-skeleton-mp2.tar.gz
I'll be sure to run it and see what I can do. be sure to create a case
that works and one that doesn't so I know exactly what you're trying to do.
--Geoff
Re: [mp2] Perl Auth Handlers and mod_proxy : losing querystring on
remote server (BUG?)
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Sylvain Perrot wrote:
> Hi,
>
> This is working !!!
> Good point... But how to handle the authentication as I wanted (no http
> authentication but my own authentication module ...)
you can always use your own authentication module, but you need to be
sure to follow the proper steps. what those are depend on what you're
trying to do...
if you're trying to do user-based authentication but not Basic
authentication then you need to follow the same set of rules rules, such
as setting $r->auth_type(), etc - you can't setup a
PerlAuthenHandler/Require and just expect that everything works without
calling the underlying API that httpd is expecting. with a
PerlAccessHandler, on the other hand, you can do just that.
a good read on this is all of
http://www.modperlcookbook.org/chapters/ch13.pdf
but particularly recipe 13.7.
HTH
--Geoff
RE: [mp2] Perl Auth Handlers and mod_proxy : losing querystring on remote server (BUG?)
Posted by Sylvain Perrot <Sy...@b-i.com>.
Hi,
This is working !!!
Good point... But how to handle the authentication as I wanted (no http
authentication but my own authentication module ...)
Sylvain
-----Original Message-----
From: Geoffrey Young [mailto:geoff@modperlcookbook.org]
Sent: mercredi, 10. janvier 2007 01:47
To: Sylvain Perrot
Cc: Modperl Mailing List
Subject: Re: [mp2] Perl Auth Handlers and mod_proxy : losing querystring
on remote server (BUG?)
> <LocationMatch /(?i)protected/>
> AuthType Basic
> AuthName "Test Authentication"
> AuthUserFile /www/xperience.ch/conf/.htpasswd
> require valid-user
> </LocationMatch>
next test - keep all that the same but substitute
PerlAuthenHandler My::Authen
for
AuthUserFile /www/xperience.ch/conf/.htpasswd
and use this handler:
package My::Authen;
use Apache2::RequestRec ();
use Apache2::Access ();
use Apache2::Const -compile => qw(OK AUTH_REQUIRED);
use strict;
sub handler {
my $r = shift;
my ($status, $password) = $r->get_basic_auth_pw;
return $status unless $status == Apache2::Const::OK;
if ($r->user eq 'foo' && $password eq 'bar') {
return Apache2::Const::OK;
}
$r->note_basic_auth_failure;
return Apache2::Const::AUTH_REQUIRED;
}
1;
just using Apache2::Const::OK in your httpd.conf bypasses some
httpd-core API calls that authen might be expecting. this setup
exercises everything pretty much the way the default file authen handler
does.
--Geoff
Re: [mp2] Perl Auth Handlers and mod_proxy : losing querystring on
remote server (BUG?)
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> <LocationMatch /(?i)protected/>
> AuthType Basic
> AuthName "Test Authentication"
> AuthUserFile /www/xperience.ch/conf/.htpasswd
> require valid-user
> </LocationMatch>
next test - keep all that the same but substitute
PerlAuthenHandler My::Authen
for
AuthUserFile /www/xperience.ch/conf/.htpasswd
and use this handler:
package My::Authen;
use Apache2::RequestRec ();
use Apache2::Access ();
use Apache2::Const -compile => qw(OK AUTH_REQUIRED);
use strict;
sub handler {
my $r = shift;
my ($status, $password) = $r->get_basic_auth_pw;
return $status unless $status == Apache2::Const::OK;
if ($r->user eq 'foo' && $password eq 'bar') {
return Apache2::Const::OK;
}
$r->note_basic_auth_failure;
return Apache2::Const::AUTH_REQUIRED;
}
1;
just using Apache2::Const::OK in your httpd.conf bypasses some
httpd-core API calls that authen might be expecting. this setup
exercises everything pretty much the way the default file authen handler
does.
--Geoff
RE: [mp2] Perl Auth Handlers and mod_proxy : losing querystring on remote server (BUG?)
Posted by Sylvain Perrot <Sy...@b-i.com>.
Hi,
I tried the following in httpd.conf :
------------------------------------------------------------------------
------
<VirtualHost *:80>
ServerAdmin admin@domain.tld
ServerName www.domain.tld
ProxyPreserveHost On
ProxyPass / http://10.0.0.100/
ProxyPassReverse / http://10.0.0.100/
CustomLog /www/doma.tld/logs/access_log combined
ErrorLog /www/doma.tld/logs/error_log
<LocationMatch /(?i)protected/>
AuthType Basic
AuthName "Test Authentication"
AuthUserFile /www/xperience.ch/conf/.htpasswd
require valid-user
</LocationMatch>
</VirtualHost>
------------------------------------------------------------------------
------
And it is working fine ... After Authentication (Basic http Auth) ... I
got the querystring passed to the application server correctly !
If I reset the virtualhost to use the PerlHandler ... The querystring is
not passed to the application server !
If someone could perform a quick test by setting up an environment to
test if he got the same problem, it would be great !
Best regards
Sylvain
-----Original Message-----
From: Geoffrey Young [mailto:geoff@modperlcookbook.org]
Sent: mercredi, 10. janvier 2007 01:16
To: Perrin Harkins
Cc: Sylvain Perrot; Modperl Mailing List
Subject: Re: [mp2] Perl Auth Handlers and mod_proxy : losing querystring
on remote server (BUG?)
Perrin Harkins wrote:
> Does it help any if you use ProxyMatch instead of LocationMatch?
also, try substituting your PerlAuthenHandler for normal .htpasswd-style
authentication at the same place - mod_perl doesn't do much to interact
with the request record, which is where the query string is stored, so
I'd be surprised if the fault is in mod_perl core.
--Geoff
Re: [mp2] Perl Auth Handlers and mod_proxy : losing querystring on
remote server (BUG?)
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Perrin Harkins wrote:
> Does it help any if you use ProxyMatch instead of LocationMatch?
also, try substituting your PerlAuthenHandler for normal .htpasswd-style
authentication at the same place - mod_perl doesn't do much to interact
with the request record, which is where the query string is stored, so
I'd be surprised if the fault is in mod_perl core.
--Geoff
RE: [mp2] Perl Auth Handlers and mod_proxy : losing querystring onremote server (BUG?)
Posted by Sylvain Perrot <Sy...@b-i.com>.
Hi,
It was a nice try ...
I setup the VirtualHost with a ProxyMatch directive :
httpd.conf :
------------------------------------------------------------------------
------
<VirtualHost *:80>
ServerAdmin admin@domain.tld
ServerName www.domain.tld
ProxyPreserveHost On
ProxyPass / http://10.0.0.100/
ProxyPassReverse / http://10.0.0.100/
CustomLog /www/domain.tld/logs/access_log combined
ErrorLog /www/domain.tld/logs/error_log
<ProxyMatch /(?i)protected/>
PerlAuthenHandler Apache2::Const::OK
Require foobar
</ProxyMatch>
</VirtualHost>
------------------------------------------------------------------------
------
And it also failed to pass the querystring to the remote server !!!
Sylvain
-----Original Message-----
From: Perrin Harkins [mailto:perrin@elem.com]
Sent: mercredi, 10. janvier 2007 01:10
To: Sylvain Perrot
Cc: Modperl Mailing List
Subject: Re: [mp2] Perl Auth Handlers and mod_proxy : losing querystring
onremote server (BUG?)
Does it help any if you use ProxyMatch instead of LocationMatch?
- Perrin
>