Conditional Lighttpd configuration based on request headers
Asked Answered
S

2

7

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't think there is looking through documentation and searching Google, but perhaps somebody knows a way.

Thanks

Sandi answered 3/6, 2010 at 21:11 Comment(0)
S
3

Following more searching I'm pretty confident that this isn't possible.

For me the solution was to change my application.

Sandi answered 8/6, 2010 at 23:59 Comment(1)
situation may have changed since, see answer of @rkianJori
S
1

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" ) 
}
Soto answered 11/4, 2019 at 12:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.