?
Solved

Lighttpd HTTP Headers

Posted on 2010-09-23
14
Medium Priority
?
707 Views
Last Modified: 2013-12-25
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
0
Comment
Question by:systemsautomation
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
14 Comments
 

Author Comment

by:systemsautomation
ID: 33756333
Someone please help.
0
 
LVL 15

Expert Comment

by:samri
ID: 33756810
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
0
 

Author Comment

by:systemsautomation
ID: 33758753
Thanks Samri

I want to do this


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

But it throws an error.

Please help
0
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 
LVL 15

Expert Comment

by:samri
ID: 33759720
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?
0
 

Author Comment

by:systemsautomation
ID: 33759880
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"] )
0
 
LVL 17

Expert Comment

by:Rovastar
ID: 33778991
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.
0
 
LVL 16

Accepted Solution

by:
The--Captain earned 2000 total points
ID: 33945074
I don't think you can directly read from $HTTP; it seems more like a matching tool.  Try creating a variable with the remote ip in it like this http://countergram.com/ip-reporting-script-lua-lighttpd and then use that variable rather than $HTTP[remoteip] in your example.

Cheers,
-Jon
0
 

Author Comment

by:systemsautomation
ID: 33974435
I think The--Captain is right. No need to close the question now
0
 
LVL 16

Expert Comment

by:The--Captain
ID: 33975549
Thanks!  I knew there had to be a way, and a challenge can be nice ;-)

Cheers,
-Jon
0

Featured Post

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question