Re: URL mapping to FastCGI app

"Emil A Eklund" <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Bryan,

If I understand you currently you'd like a single fastcgi application to
catch all requests that are not for static files/folders.
In that case, assuming you're using Apache with mod_fastcgi and mod_rewrite,
the following rewrite rules will do the trick.
fcgiapp is the path bound to the fastcgi handler, in this case an external
server.

- rewrite rules -
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ fcgiapp/$1 [T=application/x-httpd-cgi]

- external server definition -
FastCgiExternalServer /fcgiapp-host 127.0.0.1:4200
ScriptAlias /fcgiapp /fcgiapp

A request to http://domain/path/file?arg would be translated to
http://domain/fcgiapp/path/file?arg
The 3rd line (-f) prevents the rule from matching existing files, the 4th
line (-d) prevents it from matching directories.

Keep in mind that relative URIs within the returned HTML content will be
affected bu such update, so <img src="images/image.png" /> would actually
request an image from http://domain/fcgiapp/path/images/image.png, this
might or might not be what's desired. Using absolute paths will overcome
that.

As I'm sure you are aware of, the rewrite rules can either be placed in a
.htaccess file or in the main apache configuration file.

--
Emil A Eklund
([email protected])

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.