mod_rewrite proxy targets must be allowed first
15. April 2011 Hinterlasse einen Kommentar
I was trying to install a proxy redirect on my server in order to bypass the same origin policy for GWT Ajax requests. We are not using the default java servlets but a perl backend.
The Idea was to use mod_rewrite and first of all it had to be enabled. Additionally mod_proxy is used if proxy rewrites are involved. On debian this works using:
$ a2enmod rewrite; a2enmod proxy_http
The vhost config looks like this:
RewriteRule ^/mk/(.*) http://targethost/$1 [P]
# Allow the proxy to targethost ...
Allow from all
Important is the Proxy element here, which was not obvious to me from the start. I missed it and just got the following output in rewrite.log and error.log when trying to call http://gt.myhost/mk/login.
[error] client denied by server configuration: proxy:http://targethost/login
So, make sure you got the Proxy Element right, too, when using mod_rewrite and [P].