Project

General

Profile

[Solved] Mixing Conditions in setenv.add header

Added by wcndave almost 9 years ago

I have trouble mixing conditions for headers.

eg:

$HTTP[“scheme”] == “https” {
setenv.add-response-header = (“Strict-Transport-Security” => “max-age=31536000; includeSubDomains”)
}

$HTTP[“url”] =~ “/fonts/” {
setenv.add-response-header = ( “Access-Control-Allow-Origin” => “*” )
}

If I go to anything on https I get STS, unless it’s got fonts in the URL, then I get the access control header, however I lose the STS.

how can one truly “add” to the response header rather than replacing it? I have tried googling for mixing match conditions for setenv, however nothing I can find!

Many thanks

Dave


Replies (1)

RE: [Solved] Mixing Conditions in setenv.add header - Added by gstrauss about 7 years ago

As you noticed, only one of those directives is applied. The one applied is the last condition to match and define the directive.
Unfortunately, this is a limitation of lighttpd config merging, which is done at startup, and not dynamically at runtime for each request.

Further explanation and workarounds suggested in https://redmine.lighttpd.net/boards/2/topics/6541

    (1-1/1)