Forum Moderators: phranque

Message Too Old, No Replies

Rewrite rules

Reverse-proxy problem

         

rj2004

8:28 pm on Oct 1, 2009 (gmt 0)

10+ Year Member



Hello,

I am trying to setup a reverse proxy to hide application server behind a DMZ web server. I have modified the httpd.conf file on the Apache web server and able to redirect using reverse proxy but I dont want application server to expose at all.

So what kind of rewrite rules I can use to accomplish this?

Here is what I have in my web server httpd.conf file for app server access.

ProxyPassReverse / [<App...] Server IP>:Port
RewriteEngine On
ProxyPreserveHost On
RewriteRule ^/(.*) [<App...] Server IP>:Port/$1 [P]

When I access my web server [<Web...] Server>/AppServerDir it redirects me to the App Server URL.

Any help or direction in this matter?

Thanks,
RJ

jdMorgan

2:11 am on Oct 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't really need to use both ProxyPassReverse and mod_rewrite to do this. ProxyPassRevers on its own should be sufficient.

Jim

rj2004

2:32 am on Oct 2, 2009 (gmt 0)

10+ Year Member



I tried ProxyPassReverse only but does not seem to work.

I tried few other rewrite rules but no matter what I do, I am being redirected to the application server. I dont want to see application server URL.

jdMorgan

2:44 am on Oct 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well then it's likely that you've got a redirect in place in some other code, because ProxyPass and ProxPassReverse do not do redirects.

And again, you won't need to use both ProxyPass and a RewriteRule, just one or the other.

If you haven't already done so, completely flush (delete) your browser cache, and delete it again after any server-side code change (and server restart).

Jim

rj2004

1:05 pm on Oct 2, 2009 (gmt 0)

10+ Year Member



I found the redirect problem..I didn't changed the name of my proxy server in the httpd.conf of my application server/Web server.

Now I am getting proxy error while accessing the URL.
Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /web/was.dll.

Reason: Error reading from remote server

jdMorgan

1:30 pm on Oct 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please look at the error logs on both servers and post the relevant entries, identifying which error message is from which server.

Jim

rj2004

3:34 pm on Oct 2, 2009 (gmt 0)

10+ Year Member



I found the problem...and it is different issue.

How can I write a rewrite rule which can allow me to access internal website using a external url in DMZ?

for example:

[external.com...] map to [internal.com...]

not the redirect.