[users@httpd] mod_rewrite - Reverse Proxying CGIs with PATH_INFO to a Backend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux