Conditional Lighttpd configuration based on request headers
Is it possible to conditionally configure Lighttpd based on custom request headers?
It's possible to do so by IP address (and other variables):
$HTTP["remoteip"] == "0.0.0.0" {
// Do something
}
Is there something similar for request headers, for example:
$HTTP["X-Some-Header"] == "Value" {
// Do something
}
I don'开发者_C百科t think there is looking through documentation and searching Google, but perhaps somebody knows a way.
Thanks
Following more searching I'm pretty confident that this isn't possible.
For me the solution was to change my application.
You can do this with with Lighttpd from 1.4.6 onwards, see https://redmine.lighttpd.net/projects/1/wiki/docs_configuration
In my case it looks something like:
$REQUEST_HEADER["Content-Type"] == "application/rdf+xml" {
url.redirect = ( "^/somewhere/(.*)$" => "/somewhere-else" )
}
精彩评论