Alaska Software Inc. - Other extension for CGI on Apache or IIS
Username: Password:
AuthorTopic: Other extension for CGI on Apache or IIS
Thomas Braun Other extension for CGI on Apache or IIS
on Wed, 25 Aug 2004 13:15:21 +0200
Hi,

in my current setup, I'm running the production server with IIS and my
local test server with Apache. The two WAA gateways are waa1gate.isa (IIS)
and waa1gate.exe (Apache).

I did some searching on Google but could not find documentation of how to
get any of both servers to accept the other extension as a cgi gateway
program, so I don't need to change links in html files from "exe" to "isa"
before uploading them to my production server.

Anyone able to share that knowledge?

TIA
Thomas Braun
Frans VermeulenRe: Other extension for CGI on Apache or IIS
on Wed, 25 Aug 2004 13:24:14 +0200
Thomas,

> in my current setup, I'm running the production server with IIS and my
> local test server with Apache. The two WAA gateways are waa1gate.isa (IIS)
> and waa1gate.exe (Apache).
>
> I did some searching on Google but could not find documentation of how to
> get any of both servers to accept the other extension as a cgi gateway
> program, so I don't need to change links in html files from "exe" to "isa"
> before uploading them to my production server.

AFAIK, there is no limitation to what extension to use with both Apache
and IIS. (Errr... take care of the IE peculiarities with registered extensions)

In Apache there is a setting which extensions are allowed to run in cgi,
In IIS there is a setting what you want a certain extension to do.

I do not remember exactly how, but I do remember having run waa1gate.exe
at IIS with a ".iwz" extension, it was done by doing something with the mime
settings of IIS. It is for instance possible to choose ".TBr" as extension.
In Apache there must be similar settings.
(or how do you suppose it could run ".pl" files)

HTH,
Frans Vermeulen
Phil Ide
Re: Other extension for CGI on Apache or IIS
on Wed, 25 Aug 2004 12:55:25 +0100
Frans,

> In Apache there must be similar settings.
> (or how do you suppose it could run ".pl" files)

In Apache, .EXE is automatically seen as an executable.  Under nix', the
executable attribute is the key.

When it comes to non executable extensions (not .com, exe, .bat, .cmd etc),
Apache opens the file and looks for a shebang.  If it finds one, it invokes
the interpreter passing the name of the script.

If it doesn't find a shebang, it just fires the file at the OS and hopes
for the best - the best being that it is a script with a registered
handler.

You can test this in several ways:

1.  Install Perl and try a script (no shebang) through your web server.  If
perl sin't on the path, it will fail.

2.  Put a shebang in, and it will work.

3.  Remove the shebang, register Perl as a Windows Script Host language,
ensure the script is named *.pl and try again.

The best thing you can do is put perl on the path and include a shebang.
This way you can rename your scripts *.cgi etc.

The other way that Apache copes with scripts/executables, is through the
use of mod_rewrite, which can rewrite portions of the url at two points in
the processing.

1.  When the URL is recieved, but before any other processing.
2.  After the URL has been used to identify a local resource, but before
the resource is delivered.

The purpose of the second method is to allow per-directory authorisation to
be performed before applying a redirection/remapping of the url.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Never Argue With a Skunk, Mule, Woman or a SysOp
Phil Ide
Re: Other extension for CGI on Apache or IIS
on Wed, 25 Aug 2004 12:45:58 +0100
Thomas,

> in my current setup, I'm running the production server with IIS and my
> local test server with Apache. The two WAA gateways are waa1gate.isa (IIS)
> and waa1gate.exe (Apache).
> 
> I did some searching on Google but could not find documentation of how to
> get any of both servers to accept the other extension as a cgi gateway
> program, so I don't need to change links in html files from "exe" to "isa"
> before uploading them to my production server.
> 
> Anyone able to share that knowledge?

Try this on your Apache server.  If you are using VHosts, you'll need to do
this either in the global section or the VHost definition you want to apply
it to:


RewriteEngine  on
RewriteBase    /cgi-bin/
RewriteRule    ^waa1gate.isa.* waa1gate.exe

Check out mod_rewrite in the docs.  It gets complicated, so if the above
doesn't work just play around some more.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Love: two vowels, two consonants, two fools.
Phil Ide
Re: Other extension for CGI on Apache or IIS
on Wed, 25 Aug 2004 12:56:54 +0100
Thomas,

> Try this on your Apache server.  If you are using VHosts, you'll need to do
> this either in the global section or the VHost definition you want to apply
> it to:

After a quick skim through the docs, if you put this in the global section
and expect it to propogate to the VHosts, you'll need to add an inherit
flag within the vhosts (see mod_rewrite docs).

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Nothing's IMPOSSIBLE to those that don't have to do it.