We are currently using mod_proxy to proxy to proxy to the correct destination with the following line:

ProxyPass /my-path balancer://server/path/to/real/thing

However, a third party is sending us requests with the wrong content type. Getting them to change is not an option, so I thought that using mod_rewrite I would be able to do this with the following

RewriteRule ^/my-path(.*) balancer://server/path/to/real/thing$1 [P,T=text/xml]

However, this does not seem to be doing anything, and the rule does not appear to be being executed.

Is it possible to use mod_rewrite to achieve this, and am I setting this correctly for this purpose?


If your rule is not being executed then it may best to use the rewrite log to debug, details here: http://wiki.apache.org/httpd/RewriteLog

Post the log if you are having trouble interpreting it.

However You should be able to use the Header directive to do this. mod_rewrite should always be the last resort.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.