handler "fastcgi-script"

Mark Brown (mbrown@openmarket.com)
Fri, 18 Oct 1996 08:49:26 -0400

Message-Id: <199610181249.IAA13641@breckenridge.openmarket.com>
To: fastcgi-developers@openmarket.com
Subject: handler "fastcgi-script"
Date: Fri, 18 Oct 1996 08:49:26 -0400
From: Mark Brown <mbrown@openmarket.com>

Jonathan Roy notes:

    Hey, it'd be nice if I could somehow use .cgi extensions with the
    AppClass to run fastcgi scripts as well. (Instead of using .fcg.)
    That'd let me switch over cgis to fastcgi without any change in
    the html needed. (Well, aside from my trick for SSI which has
    probably been fixed in the source by now.)

Funny you should mention it.  The new handler name "fastcgi-script"
allows you to do just what you want.  With mod_fastcgi 1.3.3 you can
configure like this:

    # Start the foo.cgi app
    AppClass /path/foo.cgi

    # Have mod_fastcgi handle requests for the foo.cgi app
    <Location /path/foo.cgi>
    SetHandler fastcgi-script

Warning: I have not tried this particular config.  I don't
understand all of the possible interactions of SetHandler with
directives like AddType and ScriptAlias.  Test this config
before you deploy.  End Warning.

Modern Apache style is to eliminate the ".cgi" altogether:

    # Start the foo app
    AppClass /path/foo

    # Have mod_fastcgi handle requests for the foo app
    <Location /path/foo>
    SetHandler fastcgi-script

Now if you want to switch the app back to cgi, you change the
SetHandler line to

    SetHandler cgi-script

You can do the same thing on a directory basis:

    # Start the /path/* apps
    AppClass /path/foo
    AppClass /path/bar
    AppClass /path/bletch

    # Have mod_fastcgi handle requests for the /path/* apps
    <Location /path/>
    SetHandler fastcgi-script

with the same option of changing fastcgi-script back to cgi-script
(and commenting out the AppClass directives) when you want to run CGI.

Moral of the story: Stop using ScriptAlias and AddType.
Start using SetHandler.  See the Apache 1.1 documentation
(http://www.apache.org/docs/) for more information.


P.S. Unfortunately, the SSI problem you noticed has not been fixed yet.