|
Posted by tom on October 22, 2004, 11:23 am
Please log in for more thread options
hello
i am new to mod_perl. after reading the basic documentation i am still
not sure if i am able to do the following with mod_perl.
if a 401 http response arrives and the request url doesn't contain
e.g. "/adminApp" then forward the request to /adminApp. else return
the 401 response to the client (resp. do nothing).
is this possible with mod_perl?
thanks for your answer,
tom
|
|
Posted by Leendert Bottelberghs on November 10, 2004, 4:13 pm
Please log in for more thread options
Hi Tom,
first of all, let me try to understand your question. You say a "401 http
response arrives". Do you mean by this that the apache server has
generated a 401 response (NOT FOUND), and before this response is returned
to the client, you want to intercept the process and create your own
response.
As you might know, mod_perl enables you to hook into the different phases
of the apache request handling process. The response phase is about the
last phase in this process. I'm not sure whether you can setup a handler
that will check the response before it is actually sent (without doin lots
of other stuff). You could check if the PerlFixupHandler is of any help
(see: http://www.apacheref.com/ref/mod_perl/PerlFixupHandler.html). You
are able to check and set the status of a request within a mod_perl handler (see:
http://search.cpan.org/~gozer/mod_perl-1.29/Apache/Apache.pm#SETTING_UP_THE_RESPONSE)
If I understood your question wrong, please let me know.
-leendert bottelberghs
Op Fri, 22 Oct 2004 10:23:22 -0700, schreef tom:
> hello
>
> i am new to mod_perl. after reading the basic documentation i am still
> not sure if i am able to do the following with mod_perl.
>
> if a 401 http response arrives and the request url doesn't contain
> e.g. "/adminApp" then forward the request to /adminApp. else return
> the 401 response to the client (resp. do nothing).
>
> is this possible with mod_perl?
>
> thanks for your answer,
> tom
|
|
Posted by tom on November 11, 2004, 2:37 pm
Please log in for more thread options hello leendert
thanks for your answer. the apache server is actually doing load
balancing for several websphere clusters. the 401 (AUTHENTICATION
REQUIRED) error is generated on the websphere machines. i would like
to have one application also on one of the websphere machines which is
responsible for doing the authentication check. so, if a user tries to
connect on an application which requires authentication, the followig
should happen:
1. the 401 error gets thrown from websphere to the apache
2. apache forwards (not redirect) the 401 back to websphere to the app
which is responsible for authentication (lets call it authApp)
3. the authApp checks if the http auth-header ist set; if yes, check
why the authentication failed (password expired, wrong password, wrong
userid, etc.)
if the header is not set, throw the 401 back to the apache which
itself should pass it on to the client (browser, basic auth dialog
gets displayed). now there is the problem: the apache needs to
distinguish a 401 it receives from the authApp between a 401 it
receives from an other (normal, not authApp) application.
i think it is not possible with mod_perl because you cannot do a
forward within mod_perl, but only a redirect, right?
thanks for your help
tom
> Hi Tom,
>
> first of all, let me try to understand your question. You say a "401 http
> response arrives". Do you mean by this that the apache server has
> generated a 401 response (NOT FOUND), and before this response is returned
> to the client, you want to intercept the process and create your own
> response.
> As you might know, mod_perl enables you to hook into the different phases
> of the apache request handling process. The response phase is about the
> last phase in this process. I'm not sure whether you can setup a handler
> that will check the response before it is actually sent (without doin lots
> of other stuff). You could check if the PerlFixupHandler is of any help
> (see: http://www.apacheref.com/ref/mod_perl/PerlFixupHandler.html). You
> are able to check and set the status of a request within a mod_perl handler
(see:
>
http://search.cpan.org/~gozer/mod_perl-1.29/Apache/Apache.pm#SETTING_UP_THE_RESPONSE)
>
> If I understood your question wrong, please let me know.
>
> -leendert bottelberghs
>
> Op Fri, 22 Oct 2004 10:23:22 -0700, schreef tom:
>
> > hello
> >
> > i am new to mod_perl. after reading the basic documentation i am still
> > not sure if i am able to do the following with mod_perl.
> >
> > if a 401 http response arrives and the request url doesn't contain
> > e.g. "/adminApp" then forward the request to /adminApp. else return
> > the 401 response to the client (resp. do nothing).
> >
> > is this possible with mod_perl?
> >
> > thanks for your answer,
> > tom
|
|
Posted by Leendert Bottelberghs on November 15, 2004, 12:02 pm
Please log in for more thread options Hi Tom, thanx for your elaboration on the problem, this makes it more
comprehensible. You say that the Apache server is doing load balancing. Do
you use Apache as a reverse or forward proxy for this?
-leendert
Op Thu, 11 Nov 2004 13:37:03 -0800, schreef tom:
> hello leendert
>
> thanks for your answer. the apache server is actually doing load
> balancing for several websphere clusters. the 401 (AUTHENTICATION
> REQUIRED) error is generated on the websphere machines. i would like
> to have one application also on one of the websphere machines which is
> responsible for doing the authentication check. so, if a user tries to
> connect on an application which requires authentication, the followig
> should happen:
>
> 1. the 401 error gets thrown from websphere to the apache
> 2. apache forwards (not redirect) the 401 back to websphere to the app
> which is responsible for authentication (lets call it authApp)
> 3. the authApp checks if the http auth-header ist set; if yes, check
> why the authentication failed (password expired, wrong password, wrong
> userid, etc.)
> if the header is not set, throw the 401 back to the apache which
> itself should pass it on to the client (browser, basic auth dialog
> gets displayed). now there is the problem: the apache needs to
> distinguish a 401 it receives from the authApp between a 401 it
> receives from an other (normal, not authApp) application.
>
> i think it is not possible with mod_perl because you cannot do a
> forward within mod_perl, but only a redirect, right?
>
> thanks for your help
> tom
>
>
|
| Similar Threads | Posted | | CGI.pm and ModPerl::Registry | December 21, 2007, 11:20 pm |
| modperl and apache handlers | December 28, 2004, 5:38 am |
| CPAN conflict issue - CGI.pm vs ModPerl::Registry | September 25, 2006, 12:42 pm |
| how to check for existenceof XML tags with XML::Simple? | January 29, 2005, 12:45 pm |
| Net::SSH::Perl - Corrupted check bytes | February 8, 2006, 9:33 am |
| perl xml check for element closure | November 18, 2006, 9:26 pm |
| Email address syntax check? | December 2, 2006, 2:58 pm |
| RFC + sanity check, Tk::Text with Vi interface | April 18, 2008, 7:29 pm |
| Is there a module that can check if user "foo" may read a file? | August 5, 2005, 3:59 pm |
| Sanity check: Date::Manip versus summer time | January 24, 2006, 6:20 pm |
|