httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Bray" <>
Subject Re: [users@httpd] Access parameters in URL
Date Mon, 02 Jul 2007 12:40:21 GMT
On 02/07/07, Madonesa sanjaya <> wrote:
>      I have configured apache as a reverse proxy. Then for a particular url
> , I need to add some headers to the request. At the moment I'm doing it
> statically using the following configuration in httpd.conf file.

>  ProxyPass /care http://localhost:8080/test-care
>  ProxyPassReverse /care http://localhost:8080/test-care
>  <LocationMatch "/care">
>      RequestHeader add h1 "test1"
>      RequestHeader add h2 "test2"
>      RequestHeader add h3 "test3"
>  </LocationMatch>
>  At the moment it is working fine.But I need to change the headers
> dynamically.  I need to send the header values as URL parameters and need to
> set the three headers based on the the paramerters in the URL. Is there any
> way to do it without using script?

I'm still not exactly sure what you are asking for. From your use of
RequestHeader, I'm assuming that the headers you want to manipulate
are for the benefit of the service runnin on port 8080 to which you
are proxying? If that is the case, and you want to set headers for the
backend based on the URL, why not just get the backend to interpret
the url?

I'm not at all sure if this will work, but you could try something like:

RewriteEngine On
RewriteCond %{QUERY_STRING} foo=(.+)
RewriteRule ^/care(/.*)  http://localhost:8080/test-care$1 [E:some_env=%1]
RequestHeader add X-h1 "test1" env=some_env

Generally speaking you can't directly alter headers with mod_rewrite,
but again I don't see why you have to.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message