Link to home
Start Free TrialLog in
Avatar of systemsautomation
systemsautomationFlag for Pakistan

asked on

Lighttpd HTTP Headers

Hello

I am migrating from Apache to Lighttpd. I use following in Apache

RewriteEngine On
RewriteCond %{REMOTE_ADDR} (.*)
RewriteRule .* - [E=REMOTEA:%1]
RequestHeader set X-Oracle-Cache-User "%{REMOTEA}e"

It actually copies the IP address of the connected user to a CGI Variable X-Oracle-Cache-User.

I want to achieve same thing in Lighttpd and spent many hours but have not succeeded.

I would be really thankful if someone please give me its alternative in Lighttpd.
Deleted by _alias99, 500 points refunded. - 10/23/2010 9:10:18 AM
Avatar of systemsautomation
systemsautomation
Flag of Pakistan image

ASKER

Someone please help.
I am very-very bad with mod_rewrite, and with lighthttpd, even worst :(

found some links that could be of some help here.

http://redmine.lighttpd.net/wiki/1/MigratingFromApache
Thanks Samri

I want to do this


setenv.add-response-header = ( "X-Proxy" => $HTTP["remoteip"] )

But it throws an error.

Please help
I do not have much knowledge on rewriting to be honest.  hence, info would likely be coming from "googling" :)

What is the error you are getting?
Error:

2010-09-25 13:54:36: (configfile.c.907) source: /etc/lighttpd/lighttpd.conf line: 172 pos: 46 parser failed somehow near here: $

I have written following in the config file:
server.modules += ( "mod_setenv" )
setenv.add-response-header = ( "X-Proxy" => $HTTP["remoteip"] )
I must admit I know very little about lighttpd but I woudl check.

Can you do a simple rewrite rule that take the custom
X-Oracle-Cache-User
and can at least read it.

I know some implementations of rewrites in general you use underscores instead of the dashes.

Then also check what the actual headers are being sent to the server with a packer sniffer to make sure you ave the correct syntax.
ASKER CERTIFIED SOLUTION
Avatar of The--Captain
The--Captain
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think The--Captain is right. No need to close the question now
Thanks!  I knew there had to be a way, and a challenge can be nice ;-)

Cheers,
-Jon