Re: Stacked Handlers Location directive -- inside and outside virtualhost
Hi There, I read the following thread (with Geoff's comment in there too): http://www.gossamer-threads.com/archive/mod_perl_C1/docs-dev_F5/a_little_feedback_P38941/ than I thought about Geoff's advice about using PerlAccess Handler and came up with this concoction (which works :-) ) Conf entry: AuthName someauth AuthType someauth PerlAccessHandler Apache::MyModule PerlAuthenHandler Apache::SuperAuthen PerlAuthzHandler Apache::Xdoc require valid-user -- package Apache::SuperAuthen; use Apache::Constants qw(:common); use Apache::Registry (); use Apache::InHouseModule; use Apache::MyModule; sub handler { my $r = shift; if (Apache::MyModule::handler($r) == OK || Apache::InHouseModule::handler($r) == OK){ return OK; } return AUTH_REQUIRED; } 1; __END__ --- However, I would be please if someone can explain what actually happens. I dont "clearly" understand why it works :--) Thanks, Shashank. On Fri, 30 May 2003, Geoffrey Young wrote: > > > When http://www.abc.com/~xyz gets called PerlAuthenHandler MyModule is > > invoked. MyModule code checks for IP after reading a file from xyz > > directory. > > If the host ip matches with the one in the file, it returns OK and the > > PerlAuthzHandler never gets called and the webpage is served to the user. > > you may want to try using a PerlAccessHander for checking the IP, then > combine that with Satisfy Any (as opposed to the Satisfy All default). > > HTH > > --Geoff >
Re: Stacked Handlers Location directive -- inside and outside virtualhost
I tried that already. When I use PerlAccessHander with Satisfy Any, the webpage is always served even if IP check fails. Interestingley, when IP check fails, it redirects (https url) but never ask for any userid or password and straight away serves the page. -- Shashank On Fri, 30 May 2003, Geoffrey Young wrote: > > > When http://www.abc.com/~xyz gets called PerlAuthenHandler MyModule is > > invoked. MyModule code checks for IP after reading a file from xyz > > directory. > > If the host ip matches with the one in the file, it returns OK and the > > PerlAuthzHandler never gets called and the webpage is served to the user. > > you may want to try using a PerlAccessHander for checking the IP, then > combine that with Satisfy Any (as opposed to the Satisfy All default). > > HTH > > --Geoff >
Re: Stacked Handlers Location directive -- inside and outside virtualhost
When http://www.abc.com/~xyz gets called PerlAuthenHandler MyModule is invoked. MyModule code checks for IP after reading a file from xyz directory. If the host ip matches with the one in the file, it returns OK and the PerlAuthzHandler never gets called and the webpage is served to the user. you may want to try using a PerlAccessHander for checking the IP, then combine that with Satisfy Any (as opposed to the Satisfy All default). HTH --Geoff
Stacked Handlers Location directive -- inside and outside virtualhost
I try to do the following: Outside the virtual host (non-ssl) in the location directive, I have the following: AuthName someauth AuthType sometype PerlAuthenHandler MyModule require valid-user When http://www.abc.com/~xyz gets called PerlAuthenHandler MyModule is invoked. MyModule code checks for IP after reading a file from xyz directory. If the host ip matches with the one in the file, it returns OK and the PerlAuthzHandler never gets called and the webpage is served to the user. However, if the IP check fails, the user is redirected to another PerlAuthenHandler (which is our InHouse Authentication module) called InHouseModule. This redirection is done over ssl and thus is user is redirected to https://www.abc.com/~xyz which invokes PerlAuthenHandler InHouseModule. For this there needs to be an entry for PerlAuthenHandler InHouseModule inside virtual host like so: AuthName someauth AuthType sometype PerlAuthenHandler InHouseModule PerlAuthzHandler MyModule require valid-user Thus the user is asked for netid and password and if the authentication is successful via InhouseModule PerlAuthzHandler MyModule gets called again to do some more check by reading file. My problem is this: Everything works fine if I have the above two entries in the conf file. However, we need one single entry in access.conf so that we dont end up adding the Location directive (both inside and outside) for every URL (last count there were 250 users) and using IF condition it gets loaded in Location directive both inside and outside virtual host. Essentially we need one common entry like this in access.conf: AuthName someauth AuthType sometype PerlAuthenHandler MyModule PerlAuthenHandler InHouseModule PerlAuthzHandler MyModule require valid-user But this doesnt work when PerlAuthenHandler MyModule returns OK (i.e when IP check is successful). Probably becoz it still tries to invoke the second PerlAuthenHandler InHouseModule or maybe two PerlAuthenHandler in one location directive in itself is not the right thing to do. Then I find out about stacked_handlers and try to make this common entry work: AuthName someauth AuthType sometype PerlAuthenHandler MyModule PerlAuthzHandler MyModule require valid-user Basically take off PerlAuthenHandler InHouseModule from conf file and use $r->push_handlers( "PerlAuthenHandler", "Apache::Bluestem" ); in the PerlAuthenHandler MyModule code when it tries to do the REDIRECT (after failing IP check and before proceeding for other checks authenticating the user netid and password). I get an internal server error. Where am I going wrong? I hope I have explained myself clearly. Is there any other way of doing this? Thanks for help. -- Shashank.
Re: location directive
On Tue, 27 Nov 2001, [EMAIL PROTECTED] wrote: > I have put mod_perl handler inside a virtual host section > > then inside the virtualhost section, i also put location > directives to override overall modperl handler in some > situations, with sethandler default-handler. > > for instance > > Alias /icons/ d:/Apache/icons/ > > SetHandler default-handler > > > > this works ok as soon as the uri is /icons/file > > but modperl handler intercept if the uri is just > /icons/ which should otherwise show the directory index of the > location. > > > isn't it a sort of bug ? No. See if this post solves your problem: [EMAIL PROTECTED]">http://mathforum.org/epigone/modperl/relskoxpee/[EMAIL PROTECTED] - Perrin
location directive
Hi I have put mod_perl handler inside a virtual host section then inside the virtualhost section, i also put location directives to override overall modperl handler in some situations, with sethandler default-handler. for instance Alias /icons/ d:/Apache/icons/ SetHandler default-handler this works ok as soon as the uri is /icons/file but modperl handler intercept if the uri is just /icons/ which should otherwise show the directory index of the location. isn't it a sort of bug ? everything works ok if i put modperl handler inside a location, inside the virtual host but this is precisely what i don't want to do. "Ce message vous est envoyé par laposte.net - web : www.laposte.net/ minitel : 3615 LAPOSTENET (0,84 F TTC la minute)/ téléphone : 08 92 68 13 50 (2,21 F TTC la minute)"
Location directive on a network drive
I'm attempting to run some code off a mounted drive on RH Linux 7.1 (Apache 1.3.2, modperl-1.26), but for some reason, my Location directive is ignored (code is executed from the local drive instead) I'm pointing to /mnt/qa_load_www/cgi-shl, but code is instead executed from /apache/cgi-shl. The mounted drive is available for read, etc (if I su nobody, I can see it, etc). I've read http://perl.apache.org/guide/config.html#Alias_Configurations several times, and everything looks correct... Ideas/suggestions welcome Dave /apache/conf/httpd.conf [pertinent parts only] # # ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that # documents in the realname directory are treated as applications and # run by the server when requested rather than as documents sent to the client. # The same rules about trailing "/" apply to ScriptAlias directives as to # Alias. # Alias /cgi-shl/ /mnt/qa_load_www/cgi-shl/ # # "/apache/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # PerlModule Apache::Registry #Enable mod_perl SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI
Re: Location directive not working for mod perl
> "RB" == Rod Butcher <[EMAIL PROTECTED]> writes: RB> I believe you need the trailing / RB> i.e. Alias /perl/ "/home/httpd/perl/" RB> (but why not use Scriptalias ?) Because ScriptAlias makes it use mod_cgi rather than mod_perl. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D.Khera Communications, Inc. Internet: [EMAIL PROTECTED] Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/
Re: Location directive not working for mod perl
On Wed, 27 Dec 2000, Bill Eberle wrote: > Rod Butcher wrote: > > > I believe you need the trailing / > > i.e. Alias /perl/ "/home/httpd/perl/" > > Yes, that was it...thanks! > > > > > (but why not use Scriptalias ?) > > Somewhere in the perl.apache.org docs it was suggested that Alias was > preferrable to ScriptAlias for mod_perl. I'll have another look. http://perl.apache.org/guide/config.html#Alias_Configurations > > > > > > Rod > > > > - Original Message - > > From: "Bill Eberle" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, December 27, 2000 12:48 AM > > Subject: Location directive not working for mod perl > > > > > I hope this is the correct mailing list for newbie mod perl questions. > > > I have just installed mod_perl 1.24 with Apache 1.3.14. Mod perl seems > > > to be running because upon startup of httpd, the Apache error log file > > > says > > > > > > Apache/1.3.14 (Unix) mod_perl/1.24_02-dev configured -- resuming normal > > > operations > > > > > > The problem I'm having is that the Location directive does not seem to > > > be working. I have the following in my httpd.conf file: > > > > > > Alias /perl/ "/home/httpd/perl" > > > > > > > > > SetHandler perl-script > > > PerlHandler Apache::Registry > > > Options +ExecCGI > > > allow from all > > > PerlSendHeader On > > > > > > > > > I have placed a file called test-cgi in the directory > > > "/home/httpd/perl/". It is executable and runs if executed from the > > > command line. However, when I try to call this script through the > > > browser using the URL http://localhost/perl/test-cgi I get a 404 not > > > found error (The requested URL /perl/test-cgi was not found on this > > > server.The requested URL /perl/test-cgi was not found on this server.) > > > > > > The ScriptAlias directive works fine. I have: > > > > > > ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" > > > > > > and the same file (test-cgi) placed in /usr/local/apache/cgi-bin > > > executes without problems. > > > > > > This all seems very simple so I don't understand what I'm doing wrong. > > > Any ideas anyone? > > > > > > > > > > _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://logilune.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Location directive not working for mod perl
Rod Butcher wrote: > I believe you need the trailing / > i.e. Alias /perl/ "/home/httpd/perl/" Yes, that was it...thanks! > > (but why not use Scriptalias ?) Somewhere in the perl.apache.org docs it was suggested that Alias was preferrable to ScriptAlias for mod_perl. I'll have another look. > > Rod > > - Original Message - > From: "Bill Eberle" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, December 27, 2000 12:48 AM > Subject: Location directive not working for mod perl > > > I hope this is the correct mailing list for newbie mod perl questions. > > I have just installed mod_perl 1.24 with Apache 1.3.14. Mod perl seems > > to be running because upon startup of httpd, the Apache error log file > > says > > > > Apache/1.3.14 (Unix) mod_perl/1.24_02-dev configured -- resuming normal > > operations > > > > The problem I'm having is that the Location directive does not seem to > > be working. I have the following in my httpd.conf file: > > > > Alias /perl/ "/home/httpd/perl" > > > > > > SetHandler perl-script > > PerlHandler Apache::Registry > > Options +ExecCGI > > allow from all > > PerlSendHeader On > > > > > > I have placed a file called test-cgi in the directory > > "/home/httpd/perl/". It is executable and runs if executed from the > > command line. However, when I try to call this script through the > > browser using the URL http://localhost/perl/test-cgi I get a 404 not > > found error (The requested URL /perl/test-cgi was not found on this > > server.The requested URL /perl/test-cgi was not found on this server.) > > > > The ScriptAlias directive works fine. I have: > > > > ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" > > > > and the same file (test-cgi) placed in /usr/local/apache/cgi-bin > > executes without problems. > > > > This all seems very simple so I don't understand what I'm doing wrong. > > Any ideas anyone? > > > > > >
Re: Location directive not working for mod perl
I believe you need the trailing / i.e. Alias /perl/ "/home/httpd/perl/" (but why not use Scriptalias ?) Rod - Original Message - From: "Bill Eberle" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 27, 2000 12:48 AM Subject: Location directive not working for mod perl > I hope this is the correct mailing list for newbie mod perl questions. > I have just installed mod_perl 1.24 with Apache 1.3.14. Mod perl seems > to be running because upon startup of httpd, the Apache error log file > says > > Apache/1.3.14 (Unix) mod_perl/1.24_02-dev configured -- resuming normal > operations > > The problem I'm having is that the Location directive does not seem to > be working. I have the following in my httpd.conf file: > > Alias /perl/ "/home/httpd/perl" > > > SetHandler perl-script > PerlHandler Apache::Registry > Options +ExecCGI > allow from all > PerlSendHeader On > > > I have placed a file called test-cgi in the directory > "/home/httpd/perl/". It is executable and runs if executed from the > command line. However, when I try to call this script through the > browser using the URL http://localhost/perl/test-cgi I get a 404 not > found error (The requested URL /perl/test-cgi was not found on this > server.The requested URL /perl/test-cgi was not found on this server.) > > The ScriptAlias directive works fine. I have: > > ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" > > and the same file (test-cgi) placed in /usr/local/apache/cgi-bin > executes without problems. > > This all seems very simple so I don't understand what I'm doing wrong. > Any ideas anyone? > > >
Location directive not working for mod perl
I hope this is the correct mailing list for newbie mod perl questions. I have just installed mod_perl 1.24 with Apache 1.3.14. Mod perl seems to be running because upon startup of httpd, the Apache error log file says Apache/1.3.14 (Unix) mod_perl/1.24_02-dev configured -- resuming normal operations The problem I'm having is that the Location directive does not seem to be working. I have the following in my httpd.conf file: Alias /perl/ "/home/httpd/perl" SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI allow from all PerlSendHeader On I have placed a file called test-cgi in the directory "/home/httpd/perl/". It is executable and runs if executed from the command line. However, when I try to call this script through the browser using the URL http://localhost/perl/test-cgi I get a 404 not found error (The requested URL /perl/test-cgi was not found on this server.The requested URL /perl/test-cgi was not found on this server.) The ScriptAlias directive works fine. I have: ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" and the same file (test-cgi) placed in /usr/local/apache/cgi-bin executes without problems. This all seems very simple so I don't understand what I'm doing wrong. Any ideas anyone?
Re: Location Directive Problem
To close loop , I discovered I had redundant directives for /hello/world amongst my various *.conf files. Once I got rid of the extras I was good to go. Thanks for ideas ! Tony Tony Whyte wrote: > Running apache-1.3.11, mod_perl-1.24, irix6.5.5 > > this works: (gets handled by mod_perl) > > > SetHandler perl-script > PerlHandler Apache::Hello > > > this doesnt: > > > SetHandler perl-script > PerlHandler Apache::Hello > > > Tried quoting "/hello/world" I still get "File does not exist: > /usr/local/apache/htdocs/hello/world" in logs. > > Is there some other directive Ive missed or misconfigured. > > Thanks > > Tony
Re: Location Directive Problem
On Thu, 17 Aug 2000, Tony Whyte wrote: > > Running apache-1.3.11, mod_perl-1.24, irix6.5.5 > > this works: (gets handled by mod_perl) > > > SetHandler perl-script > PerlHandler Apache::Hello > > > this doesnt: > > > SetHandler perl-script > PerlHandler Apache::Hello > > > Tried quoting "/hello/world" I still get "File does not exist: > /usr/local/apache/htdocs/hello/world" in logs. > > Is there some other directive Ive missed or misconfigured. Are you sure that you don't have a directory called /hello under the DocRoot? Anyway, running the request under strace should reveal more details: http://thingy.kcilink.com/modperlguide/debug/Using_the_System_Calls_Trace.html > > Thanks > > Tony > > > _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://jazzvalley.com http://singlesheaven.com http://perlmonth.com perl.org apache.org
Location Directive Problem
Running apache-1.3.11, mod_perl-1.24, irix6.5.5 this works: (gets handled by mod_perl) SetHandler perl-script PerlHandler Apache::Hello this doesnt: SetHandler perl-script PerlHandler Apache::Hello Tried quoting "/hello/world" I still get "File does not exist: /usr/local/apache/htdocs/hello/world" in logs. Is there some other directive Ive missed or misconfigured. Thanks Tony