You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by William Wilson <wi...@appliedgenerics.com> on 2003/04/14 11:08:22 UTC

[users@httpd] Dynamic Proxying

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear Fellow Listees,


I'm currently trying to set up a proxying server that reveals an intranet to 
the outside world, using Apache 2.0.39. I'd like to do it in this fashion:

http://external.host/intranet.host/some.file

is proxied by the external host to 

http://intranet.host/some.file

if the URL http://external.host/intranet.host/some.file doesn't exist on the 
local machine.

I thought I'd do this using mod_rewrite and it's proxy pass feature. I set up 
this rule:

RewriteMap path-to-host txt:/etc/apache/map/map.path-to-host

RewriteCond %{IS_SUBREQ} =false
RewriteCond %{REQUEST_URI} !-U
RewriteRule ^/([^/]+)/(.*)    http://${path-to-host:$1}/$2     [proxy]

The first condition should see that sub requests aren't proxied. The second 
condition should use a subrequest to see if the URL is valid (which it won't 
be if it doesn't exists locally). If these conditions are met then the URL is 
rewritten as shown above using a map file that maps the path fragment to an 
intranet host. However, this doesn't work. If I connect to the external host

http://external.host/intranet.host/some.file

I just get 404 Not Found. Bumping up the log verbosity revealed that the 
second rewrite condition ( the !-U  subrequest) was returning an HTTP code of 
200 (success) for URLs that are not valid on the external host(and should 
infact be returning 404) and therefore the !-U condition was never met.

Can anyone suggest why this doesn't work or perhaps suggest an easier way of 
solving the above problem?


Many Thanks,


Will



- -- 
Will Wilson					

Applied Generics Ltd
Pentlands Science Park
Bush Loan, Penicuik
Scotland, EH26 OPZ

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+mnqGNAhBZq2mRiYRAqCyAJ9yh/epquhtMXYmbpN3/kyrjC+G/ACglcBJ
+VfCD/pozclHvafZpMJGuX0=
=DyQm
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
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