开发者

Conditional Lighttpd configuration based on request headers

开发者 https://www.devze.com 2023-01-01 23:40 出处:网络
Is it possible to conditionally configure Lighttpd based on custom request headers? It\'s possible to do so by IP address (and other variables):

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" ) 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消