Re: Access parameters in URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/07/07, Madonesa sanjaya <sanjayamrt@xxxxxxxxx> 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.

--
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux