httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Bare <kbare-apacheus...@club.cc.cmu.edu>
Subject [users@httpd] mod_rewrite - Reverse Proxying CGIs with PATH_INFO to a Backend
Date Sat, 07 May 2005 06:52:24 GMT
I want to setup two machines: one will handle static pages, the second
will handle CGI scripts.  I would like all clients to connect to the
first machine, which will use mod_rewrite to transparently proxy
requests for CGIs to the second.

This seems like it would as simple as

RewriteRule /(.*\.cgi)$ http://cgi-backend/$1 [P]

but this fails for CGI scripts that use PATH_INFO.

I have written a Perl script that, when used as a RewriteMap, fakes
knowing whether or not a request is for a CGI by walking backwards
through a path until it finds a directory or file that exists.
However, this has the drawback that I need to map URLs to local paths
manually with RewriteRules, and then convert the path back to a URL
for proxying if the path references a CGI.

I imagine there has to be some better way to do this.  Is there some
way, for example, that I could tell, using a RewriteCond, if a request
would result in a CGI being executed?  If not, what is the recommended
way to implement the described setup?

Thank you,
Keith Bare

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message