Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an app that uses lighttpd to log requests to a pixel, but the client doesn't need any response. Currently the requests map to a small static image. Is there a way to configure lighttpd to respond to these requests with a 204 header without using any fcgi/etc handler? I.e. done purely by the lighty server itself?

share|improve this question
    
What a useful question, Andy. –  akellehe Jul 24 '13 at 20:37

2 Answers 2

up vote 3 down vote accepted

Lighttpd doesn't seem to have an option to do this, so the only way would be to write a Lua script using mod_magnet. The script shouldn't require more than this:

return 204

And the corresponding configuration:

server.modules += ( "mod_magnet" )
$HTTP["url"] == "/somepath" {
    magnet.attract-raw-url-to = ( "/etc/lighttpd/204.lua" )
}
share|improve this answer
    
This works great! Thanks. –  akellehe Jul 25 '13 at 14:38

Did you try using: setenv.add-response-header = ()? (This requires "mod_setenv")

share|improve this answer
1  
The response code is part of the http response's status line, not the headers, so I don't think setenv does the trick –  yacomink Jun 21 '11 at 15:58
    
You are completely right:) Sorry –  Aleksey Korzun Jun 21 '11 at 21:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.