You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Michael Gale <mi...@bluesuperman.com> on 2004/01/16 06:43:38 UTC

[users@httpd] Reverse Proxy and mod_rewrite

Hello,

	I have a small insecure http listener on 127.0.0.1:3000 and I want to
be able to access it via www.mydomain.com.

I am running Apache 2.0.47 but will be upgrading soon to the latest
2.0.X. I also have the latest mod_perl and PHP 4.something.

I have added the following to my httpd.conf file but am having issues.

--<snip>--
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http:\/\/www\.mydomain\.com/monitoring/.* 
RewriteCond %{REQUEST_URI} !^/monitoring/.* 
RewriteRule ^/(.*) http://www.mydomain.com/monitoring/$1 [L,P]

###  ProxyPassReverse

ProxyRequests On
<Location /monitoring/>
        ProxyPass http://127.0.0.1:3000/
        ProxyPassReverse http://127.0.0.1:3000/
        SetEnv force-proxy-request-1.0 1       
        SetEnv proxy-nokeepalive 1      
</Location>                       
--<snip>--

I am access the initial page of the server fine on 127.0.0.1:3000 and
all subsquent pages that use relative paths but some of the links use
absolute paths. I think this is referred to non-canonical urls.

Anyways ... so I need to have the requested URL rewritten to include the
full path, if is a users request /infopage and the HTTP_REFERER is
http://www.mydomain.com/monitoring/* then add
http://www.mydomain.com/monitoring/ to the front of it.

I tried placing the logs in debug but it says nothing about rewrite
that I can see.

[Thu Jan 15 22:40:02 2004] [debug] proxy_http.c(109): proxy: HTTP:
canonicalising URL //127.0.0.1:3000/style.css
[Thu Jan 15 22:40:02 2004][debug] mod_proxy.c(459): Trying to run
scheme_handler
[Thu Jan 1522:40:02 2004] [debug] proxy_http.c(1076): proxy: HTTP:
serving URL http://127.0.0.1:3000/style.css
[Thu Jan 15 22:40:02 2004] [debug] proxy_http.c(221): proxy: HTTP
connecting http://127.0.0.1:3000/style.css to 127.0.0.1:3000
[Thu Jan 15 22:40:02 2004] [debug] proxy_util.c(1203): proxy: HTTP: fam
2 socket created to connect to 127.0.0.1
[Thu Jan 15 22:40:02 2004] [debug] proxy_http.c(370): proxy: socket is
connected
[Thu Jan 15 22:40:02 2004][debug] proxy_http.c(404): proxy: connection
complete to 127.0.0.1:3000(127.0.0.1)
[Thu Jan 15 22:40:02 2004] [debug] proxy_http.c(917): proxy: start body
send
[Thu Jan 15 22:40:02 2004] [debug] proxy_http.c(976): proxy: end body
send



-- 
Hand over the Slackware CD's and back AWAY from the computer, your geek
rights have been revoked !!!

Michael Gale
Slackware user :)
Bluesuperman.com 

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