Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Apache is a reverse-proxy to my app. A client requests

GET /foo/images/logo.png HTTP/1.1

I want Apache to modify the request so that the app on the other side of the reverse proxy receives it in the format

GET /images/logo.png HTTP/1.1

Rewriting the URL is easy, but I haven't found a way to modify the Host header with a value extracted from the URL. Is this possible?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Yes, you can change headers based on URIs. It's ugly though -- This is the only way I know of to do it:

  1. Use SetEnvIF to set an environment variable if the URI matches what you want to rewrite.

  2. Use mod_headers' RequestHeader directive to reset the appropriate Request Header (Host:) if that environment variable is set.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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