Apache mod_proxy vs mod_rewrite

apache-2.2mod-proxymod-rewrite

What is the difference between using mod_proxy and mod_rewrite?

I have a requirement to send certain url patterns through the tomcat, which runs on the same host but under port 8080. I know this is something for mod_proxy, but I"m wondering why I can't just use mod_rewrite, or what the difference is?

Probably has to do w/ reverse proxy, and also when in the pipeline it gets handled?

Thanks.

Best Answer

mod_rewrite using the P flags puts the request through mod_proxy. The advantage in using mod_rewrite is that you get more control for mapping requests, just like rewrite let's you rewrite URLs. But the proxying is exactly the same. The disadvantage is that mod_rewrite syntax is more complex. So my recommendation is to use mod_proxy -style configuration directives unless you need something more complicated. Others will probably recommend mod_rewrite -style, because then you only have to learn one style.

Related Topic