FastCGI documentation update

In trying to get FastCGI going, I discovered a typo and how to get FastCGI
working.

There is a typo on

http://fsck.com/rtfm/article.html?id=2

I think the line

AddHandler fastcgi-script fsgi

should read

AddHandler fastcgi-script fcgi

the last s → c.

The documented additions to httpd.conf for FastCGI are:

 LoadModule    fastcgi_module modules/mod_fastcgi.so
 AddModule     mod_fastcgi.c
 AddHandler    fastcgi-script fsgi
 FastCgiServer /path/to/rt2/bin/mason_handler.fcgi
 ScriptAlias   / /path/to/rt2/bin/mason_handler.fcgi

ScriptAlias will send all requests for any HTML and non-HTML content to
the mason_handler.fcgi, which is not what one wants to do. Only URLs ending
in / or .html should be handled by the mason_handler.fcgi and everything
else served normally. This does the trick:

 LoadModule      fastcgi_module modules/mod_fastcgi.so
 AddModule        mod_fastcgi.c
 AddHandler       fastcgi-script fcgi
 FastCgiServer    /path/to/rt2/bin/mason_handler.fcgi
 ScriptAliasMatch (.*/)$      /path/to/rt2/bin/mason_handler.fcgi$1
 ScriptAliasMatch (.*\.html)$ /path/to/rt2/bin/mason_handler.fcgi$1

Best,
Blair

Blair Zajac blair@orcaware.com
Web and OS performance plots - Orca Home Page - OrcaWare Technologies

Indeed there is a typo in the docs. Thanks very much. I’ll fix that
up right now.

As a heads up, you should be aware that your configuration change will break
attachment downloading.

-jOn Wed, Jan 09, 2002 at 08:50:42AM -0800, Blair Zajac wrote:

In trying to get FastCGI going, I discovered a typo and how to get FastCGI
working.

There is a typo on

http://fsck.com/rtfm/article.html?id=2

I think the line

AddHandler fastcgi-script fsgi

should read

AddHandler fastcgi-script fcgi

the last s → c.

The documented additions to httpd.conf for FastCGI are:

 LoadModule    fastcgi_module modules/mod_fastcgi.so
 AddModule     mod_fastcgi.c
 AddHandler    fastcgi-script fsgi
 FastCgiServer /path/to/rt2/bin/mason_handler.fcgi
 ScriptAlias   / /path/to/rt2/bin/mason_handler.fcgi

ScriptAlias will send all requests for any HTML and non-HTML content to
the mason_handler.fcgi, which is not what one wants to do. Only URLs ending
in / or .html should be handled by the mason_handler.fcgi and everything
else served normally. This does the trick:

 LoadModule      fastcgi_module modules/mod_fastcgi.so
 AddModule        mod_fastcgi.c
 AddHandler       fastcgi-script fcgi
 FastCgiServer    /path/to/rt2/bin/mason_handler.fcgi
 ScriptAliasMatch (.*/)$      /path/to/rt2/bin/mason_handler.fcgi$1
 ScriptAliasMatch (.*\.html)$ /path/to/rt2/bin/mason_handler.fcgi$1

Best,
Blair


Blair Zajac blair@orcaware.com
Web and OS performance plots - Orca Home Page - OrcaWare Technologies


rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.

Jesse Vincent wrote:

Indeed there is a typo in the docs. Thanks very much. I’ll fix that
up right now.

As a heads up, you should be aware that your configuration change will break
attachment downloading.

    -j

OK. Did the previous method with ScriptAlias ever work?

Would an additional ScriptAlias work that checks for something like

ScriptAliasMatch ^/Ticket/Attachment(/.*)$ \
    /path/to/rt2/bin/mason_handler.fcgi/Ticket/Attachment/dhandler$1

work? I tried to get this going, but it doesn’t work.

Blair

Blair Zajac blair@orcaware.com
Web and OS performance plots - Orca Home Page - OrcaWare Technologies

Jesse Vincent wrote:

As a heads up, you should be aware that your configuration change will break
attachment downloading.

    -j

OK. Did the previous method with ScriptAlias ever work?

Yeah. I’ve used it a fair bit on development/testing boxes. Though it would
be good to hear from the field too.

Would an additional ScriptAlias work that checks for something like

ScriptAliasMatch ^/Ticket/Attachment(/.*)$ \
    /path/to/rt2/bin/mason_handler.fcgi/Ticket/Attachment/dhandler$1

work? I tried to get this going, but it doesn’t work.

I’m not familiar with ScriptAliasMatch.
I believe you’d also have to do the same thing for SelfService.
What inside the RT tree do you want to serve out without the fastcgi handler?

-j

http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.

Jesse Vincent wrote:

Jesse Vincent wrote:

As a heads up, you should be aware that your configuration change will break
attachment downloading.

    -j

OK. Did the previous method with ScriptAlias ever work?

Yeah. I’ve used it a fair bit on development/testing boxes. Though it would
be good to hear from the field too.

I’m using Apache 1.3.22 and when I use

ScriptAlias / /path/to/rt2/bin/mason_handler.fcgi

for anything else than RT’s home page, I get these error logs:

[Wed Jan  9 12:57:17 2002] [error] [client 172.30.1.171] script not found
or unable to stat: /export/home1/apache/rt-2.0.11/bin/mason_handler.fcgiUser

This is trying to request

http://rt/User/Prefs.html

When I try to request

http://rt/NoAuth/webrt.css

I get a 404.

When I use ScriptAliasMatch, I pass only the stuff off to FastCGI that needs
to be handled (modulo the SelfService and attachment downloading).

Would an additional ScriptAlias work that checks for something like

ScriptAliasMatch ^/Ticket/Attachment(/.*)$ \
    /path/to/rt2/bin/mason_handler.fcgi/Ticket/Attachment/dhandler$1

work? I tried to get this going, but it doesn’t work.

I’m not familiar with ScriptAliasMatch.

It lets you use more complicated regular expression in the match and save
the matches inside of ()'s to the target path.

I believe you’d also have to do the same thing for SelfService.

OK.

What inside the RT tree do you want to serve out without the fastcgi handler?

I want to use fastcgi everywhere, but when

    -j


http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.

Blair Zajac blair@orcaware.com
Web and OS performance plots - Orca Home Page - OrcaWare Technologies

I’m using Apache 1.3.22 and when I use

ScriptAlias / /path/to/rt2/bin/mason_handler.fcgi

Try

ScriptAlias / /path/to/rt2/bin/mason_handler.fcgi/

http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.

Jesse Vincent wrote:

I’m using Apache 1.3.22 and when I use

ScriptAlias / /path/to/rt2/bin/mason_handler.fcgi

Try

ScriptAlias / /path/to/rt2/bin/mason_handler.fcgi/

OK. The last / is missing in the documentation for FastCGI on

http://fsck.com/rtfm/article.html?id=2

That works a lot better, but for non-HTML content, such as

http://rt/NoAuth/images/rt.jpg

When using mod_perl, the Content-Type is properly set:

wget -S http://rt/NoAuth/images/rt.jpg
–13:14:06-- http://rt/NoAuth/images/rt.jpg
=> `rt.jpg’
Resolving rt… done.
Connecting to rt[172.30.1.12]:80… connected.
HTTP request sent, awaiting response…
1 HTTP/1.1 200 OK
2 Date: Wed, 09 Jan 2002 21:14:06 GMT
3 Server: Apache/1.3.22 (Unix) mod_fastcgi/2.2.12 mod_perl/1.26_01-dev
mod_throttle/3.1.2
4 Last-Modified: Tue, 06 Nov 2001 23:07:00 GMT
5 ETag: “1fa27-395-3be86d14”
6 Accept-Ranges: bytes
7 Content-Length: 917
8 Keep-Alive: timeout=30, max=100
9 Connection: Keep-Alive
10 Content-Type: image/jpeg

100%[====================================>] 917 895.51K/s ETA 00:00

13:14:06 (895.51 KB/s) - `rt.jpg’ saved [917/917]

However, using FastCGI with ScriptAlias / /path/to/rt2/bin/mason_handler.fcgi/,
the Content-Type is incorrect: text/html:

it1% wget -S http://rt/NoAuth/images/rt.jpg
–13:14:24-- http://rt/NoAuth/images/rt.jpg
=> `rt.jpg’
Resolving rt… done.
Connecting to rt[172.30.1.12]:80… connected.
HTTP request sent, awaiting response…
1 HTTP/1.1 200 OK
2 Date: Wed, 09 Jan 2002 21:14:24 GMT
3 Server: Apache/1.3.22 (Unix) mod_fastcgi/2.2.12 mod_perl/1.26_01-dev
mod_throttle/3.1.2
4 X-comp: X/NoAuth/images/rt.jpgX
5 Set-Cookie: AF_SID=a19bfd8918e3f1227f9ad84d5ae20704; path=/
6 Connection: close
7 Content-Type: text/html

[ <=>                                 ] 913          891.60K/s

13:14:24 (891.60 KB/s) - `rt.jpg’ saved [913]

It looks like the handler is handling everything, not just HTML content.

Blair

Blair Zajac blair@orcaware.com
Web and OS performance plots - Orca Home Page - OrcaWare Technologies

OK. The last / is missing in the documentation for FastCGI on

http://fsck.com/rtfm/article.html?id=2

Not anymore. Fixed it about 10 minutes ago :wink:

That works a lot better, but for non-HTML content, such as

http://rt/NoAuth/images/rt.jpg

nod That’s why there’s a config file frob to specify an alternate url
which isn’t served through RT’s handler for images and other similar data.

It looks like the handler is handling everything, not just HTML content.

Correct. which it needs to do to handle attachments properly. I wasn’t willing
to introduce an additional dependency on a library to do mime-type lookups,
especially since the extant library is very unix-centric and I suspect that
fastcgi is the best possible avenue for a potential port to non-Unix OSen.
If you can make a configuration based on AliasMatch directives work, I’d
love to include that in the docs.

Thanks


-j	

Blair


Blair Zajac blair@orcaware.com
Web and OS performance plots - Orca Home Page - OrcaWare Technologies

http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.

Jesse Vincent wrote:

As a heads up, you should be aware that your configuration change will break
attachment downloading.

OK. Did the previous method with ScriptAlias ever work?

Having messed about with various aliasing and handler settings with
RT, I’ve noticed one problem that is rarely addressed is downloading
of Elements components.

If Mason is only used for requests ending in “/” or “.html”, a user
can download any Elements file and view its source. This isn’t a huge
problem, but it’s not what you’d expect, and it might help malicious
users find out more about a site’s configuration.

Tom

That works a lot better, but for non-HTML content, such as

http://rt/NoAuth/images/rt.jpg

nod That’s why there’s a config file frob to specify an alternate url
which isn’t served through RT’s handler for images and other similar data.

Would you be so kind to mention that in the installation guide under
“Apache with fastcgi”? It might save somebody else the hour that I tried
to debug apache/fastcgi/mason/rt.

Fabian

It is just the graphic, after all… :slight_smile:

-Rich

Fabian Ritzmann wrote:>On Wed, 2002-01-09 at 23:20, Jesse Vincent wrote:

That works a lot better, but for non-HTML content, such as

http://rt/NoAuth/images/rt.jpg

nod That’s why there’s a config file frob to specify an alternate url
which isn’t served through RT’s handler for images and other similar data.

Would you be so kind to mention that in the installation guide under
“Apache with fastcgi”? It might save somebody else the hour that I tried
to debug apache/fastcgi/mason/rt.

Fabian

It is just the graphic, after all… :slight_smile:

It had some unpleasant side-effects on our authentication system. I’ll
submit a few patches once I have some time to test the fastcgi setup. I
plan to have all references to /NoAuth replaced by a configurable URL
just like the WebImagesURL.

Fabian