Re: Mod-ReWrite

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

 



Hi,

thanks very much for your help with this. I am a bit unclear in how information is assigned to variables and how they can be passed from one directive to another.

I made the change that you described below. Now the tkn header is coming in as null.   Have I made an error in assigning the tkn to var1?

URL -> http://localhost/test_rpc/header.jsp?tkn=abc
Header value -> tkn: (null)

RewriteCond %{QUERY_STRING} tkn=(.*)
RewriteRule ^/test_rpc/$ [E=var1:%1]
RequestHeader append tkn %{var1}e


Thanks for your help
Suneet



On Sat, Sep 24, 2011 at 4:25 PM, Mark Montague <mark@xxxxxxxxxxx> wrote:
On September 24, 2011 16:06 , Suneet Shah <suneetshah2000@xxxxxxxxx> wrote:
I have the following url:
http://localhost/test_rpc/header.jsp?tkn=abc

In my httpd.conf I added the following:

RewriteEngine on
Options +FollowSymLinks

RewriteCond %{QUERY_STRING} tkn=(.*)
RewriteRule ^/test_rpc/$ [E=var1:%1]
RequestHeader append tkn var1

In my test, the Header "tkn" shows up with a value of "var1", instead of "abc" which is on the query string.


The RequestHeader directive you currently have means "append the literal string 'var1' to the value of the header named 'tkn'"; this is why you are seeing the above result in your test.  The RequestHeader directive does not know that you want it to interpret 'var1' as the name of an environment variable, because you have not told it to do so.

In order to append the value of the environment variable named 'var1' to the header named 'tkn', try

RequestHeader append tkn %{var1}e

For more information, see

https://httpd.apache.org/docs/2.2/mod/mod_headers.html#requestheader
https://httpd.apache.org/docs/2.2/mod/mod_headers.html#header

--
 Mark Montague
 mark@xxxxxxxxxxx



[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