Installing global handler breaks CGI
Hi, I'm lost on this one. I'm trying to install a simple handler that will get called on every request. My first try at this is: Location / SetHandler perl-script PerlAccessHandler My::Access /Location Right now the handler does nothing except write to the log and return DECLINED. It works fine. However, what does NOT work any longer is standard CGI (/cgi-bin/whatever). Instead of executing, my CGI script is returned to the browser. I'm guessing that somehow the location of "/" is overriding the ExecCGI-ness of /cgi-bin, but I don't know why, nor can I find any way of putting it back. If I remove the above Location block, CGI returns to normal. Can anyone explain this to me? Thanks, Fred Toth [EMAIL PROTECTED]
RE: Installing global handler breaks CGI
-Original Message- From: Fred Toth [mailto:[EMAIL PROTECTED]] Sent: Friday, March 09, 2001 1:03 PM To: [EMAIL PROTECTED] Subject: Installing global handler breaks CGI Hi, I'm lost on this one. I'm trying to install a simple handler that will get called on every request. you can place any Perl*Handler at a server level (well, except PerlHandler I guess) and it will apply to all requests received by the server. PerlAccessHandler My::Access Location ... My first try at this is: Location / SetHandler perl-script PerlAccessHandler My::Access /Location well, Directory controls things of a filesystem basis and Location controls on a URL basis. for both Directory and Location / is kinda special - I think I remember reading a thread on new-httpd that talked about why / was not merged the same way as other places, but I'm not sure. At any rate, you typically don't see Perl*Handlers installed for / see the apache docs on both directives for more general info... HTH --Geoff Right now the handler does nothing except write to the log and return DECLINED. It works fine. However, what does NOT work any longer is standard CGI (/cgi-bin/whatever). Instead of executing, my CGI script is returned to the browser. I'm guessing that somehow the location of "/" is overriding the ExecCGI-ness of /cgi-bin, but I don't know why, nor can I find any way of putting it back. If I remove the above Location block, CGI returns to normal. Can anyone explain this to me? Thanks, Fred Toth [EMAIL PROTECTED]
Re: Installing global handler breaks CGI
On Fri, 9 Mar 2001, Fred Toth wrote: Hi, I'm lost on this one. I'm trying to install a simple handler that will get called on every request. My first try at this is: Location / SetHandler perl-script PerlAccessHandler My::Access /Location Right now the handler does nothing except write to the log and return DECLINED. It works fine. However, what does NOT work any longer is standard CGI (/cgi-bin/whatever). Instead of executing, my CGI script is returned to the browser. Try adding: Location /cgi-bin/ Options +ExecCGI /Location or even a complete section: Alias /cgi-bin /home/httpd/cgi-bin Location /cgi-bin SetHandler cgi-script Options +ExecCGI /Location I'm guessing that somehow the location of "/" is overriding the ExecCGI-ness of /cgi-bin, but I don't know why, nor can I find any way of putting it back. If I remove the above Location block, CGI returns to normal. Can anyone explain this to me? Thanks, Fred Toth [EMAIL PROTECTED] _ 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: Installing global handler breaks CGI
Stas, SBTry adding: SBLocation /cgi-bin/ SB Options +ExecCGI SB/Location This is a fine fix; I'm actually curious, now that it's been brought up, as to why ScriptAlias suddenly breaks. In my config if I have this outside of a Directory, Location, or other container: FilesMatch "\.pl$" SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader On /FilesMatch Then anything before like this which IS inside a container: Location ... ... ScriptAlias /cgi-bin/ /path/to/cgi-bin/ Directory /path/to/cgi-bin/ Options FollowSymLinks AllowOverrideNone /Directory /Location Stops working. Fixing this is easy--I just SetHandler cgi-script inside the Directory ... container. So is the ScriptAlias priority lower than the FilesMatch assignment? I always thought ScriptAlias was just shorthand for Alias + Location ... + SetHandler. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Installing global handler breaks CGI
On Fri, 9 Mar 2001, Andrew Ho wrote: Stas, SBTry adding: SBLocation /cgi-bin/ SB Options +ExecCGI SB/Location This is a fine fix; I'm actually curious, now that it's been brought up, as to why ScriptAlias suddenly breaks. In my config if I have this outside of a Directory, Location, or other container: FilesMatch "\.pl$" SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader On /FilesMatch Then anything before like this which IS inside a container: Location ... ... ScriptAlias /cgi-bin/ /path/to/cgi-bin/ Directory /path/to/cgi-bin/ Options FollowSymLinks AllowOverrideNone /Directory /Location Stops working. Fixing this is easy--I just SetHandler cgi-script inside the Directory ... container. So is the ScriptAlias priority lower than the FilesMatch assignment? May be this happens, due to the fact that you define a new section handling the same location/directory? This is sort of Apache specific one, to figure out what are the precedence and inheritance rules. I guess delving into the docs on this will provide the answer. I always thought ScriptAlias was just shorthand for Alias + Location ... + SetHandler. This is correct. What happens if you don't use the shortcut, but define the cgi-bin behavior explicitly, just like you do for mod_perl? _ 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/