I'm trying to push a value into the HTTP Request Header. The end result that I need is that I need %{REMOTE_ADDR} sent into the Request Header as "onBehalfOf" ...so I loaded mod_headers.so I created a dummy.jsp running in Tomcat6 that dumps out all of the Environment variables and their values to the screen. I went into my VirtualHost and modified to set a RequestHeader. Virtual Host looks like this: <VirtualHost 127.0.0.1> DocumentRoot "C:/Corporate Sites/brand1" ServerName brand1.local RewriteEngine On RewriteCond %{REMOTE_ADDR} (.*) RewriteRule .* - [E=OnBehalfOf:%{REMOTE_ADDR},NE] RequestHeader set onBehalfOf "%{OnBehalfOf}e" RewriteCond %{REQUEST_URI} ^/$ RewriteRule .* /webapp/index.jsp RewriteRule ^/webapp/(.*) http://brand1.local:8080/webapp/$1 </VirtualHost> I tried passing REMOTE_ADDR directly into the RequestHeader directive, but it would not work. I found a resource online saying that there was a problem with "REMOTE_USER" and this was how they solved it, so I mimicked their technique. However, this will not work either. The "onBehalfOf" RequestHeader is never written, but if I use Firefox:Modify Headers and input it directly then refresh my dummy.jsp, my entry gets put into the Header....something's wrong and I cannot for the life of me find any information on how to get this worked out. I've tried a bunch of different configs of the VirtualHost and the snippet I provided above is just the latest version I tried. I'm still digging, but I'm not finding anything at all : \ ....help?
D'Oh!!! I guess I helped myself by posting it in here lol ...I hadn't set the Proxy flag on the final RewriteRule. RewriteRule ^/webapp/(.*) http://brand1.local:8080/webapp/$1 [P,L] sends its RequestHeader on. No, the header is getting set, but it's putting a NULL in it. Anyone know why?
[as an aside, how long do you have to edit your own posts before they get locked? ...first time I've ever seen that on a forum] ...ok. So I got this all fixed. I'm posting my solution in here for posterity. Note that I masked my IP. Since my host is statically chained to Tomcat, it didn't make sense to use an environment variable for this...besides. REMOTE_ADDR would have put 127.0.0.2 in and this proxy call will be leaving my local box...hope this helps somebody. <VirtualHost 127.0.0.2> DocumentRoot "C:/Corporate Sites/brand1" ServerName brand1.local RewriteEngine On RewriteRule .* - [E=TOMCAT_IP:10.xxx.xxx.xxx] RewriteRule .* - [E=TOMCAT_PORT:8080] RewriteRule .* - [E=TOMCAT_HOST:brand1] RequestHeader append on-behalf-of %{TOMCAT_IP}e RequestHeader append on-behalf-of %{TOMCAT_PORT}e RequestHeader append on-behalf-of %{TOMCAT_HOST}e RewriteCond %{REQUEST_URI} ^/$ RewriteRule .* /webapp/index.jsp RewriteRule ^/webapp/(.*) http://brand1.local:8080/webapp/$1 [P,L] </VirtualHost> Code (markup):