# In Apache you can setup a reverse proxy with either RewriteRule or ProxyPass

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.

With Apache I have always done something like this:

ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/

But I just saw this interesting bit on StackOverflow:

RewriteEngine On
RewriteRule ^(/.*)$http://app-server:8181/jellyfish$1 [P]
ProxyPassReverse / http://app-server:8181/jellyfish/

Which does the same thing. The RewriteRule says “grab everything after the first slash and turn that into ‘\$1’ which we will then append to the end of the url that our hidden service is expecting.”

And looking at the official docs, I see that this is understood as official doctrine:

A reverse proxy is activated using the ProxyPass directive or the [P] flag to the RewriteRule directive. It is not necessary to turn ProxyRequests on in order to configure a reverse proxy.

Source