conditional configuration documentation

Added by dmrzzz over 11 years ago

First of all, thanks for a great product! I have one suggestion for the documentation: as a new user, I spent a long time trying to do things like this:

$HTTP["host"] == "" {
  # Rewrite one specific URL under
  url.rewrite-once = (
    "^/specificURLToRewrite" => "/specificTarget" 

# Any request not rewritten yet will get rewritten here (I WISH)
url.rewrite-once = ( ".*" => "/capture$0" )

in the hope that the second rule would also apply to requests for as long as they did not match the pattern "^/specificURLToRewrite" (this seemed consistent in my mind with the documented description of url.rewrite-once). In fact other URLs for do not get rewritten at all by the above config.

Today I had an epiphany: any given option (e.g. url.rewrite-once) only gets one value for each request being handled; the value set within an applicable conditional replaces (i.e. obscures) any value set in global context for the same option.

In retrospect this seems perfectly sensible, maybe even "obvious", but it took me a fair bit of stumbling around to figure it out, and I think the reason why is that doesn't specifically address what happens when the same option is configured both in global context and within a conditional.

I'm not confident enough in my conclusions to edit the wiki myself, but a sentence or two in the docs specifically clarifying this (from someone who knows for sure) would be awesome. Bonus points for also covering the case where the same option is set within two different conditionals that might both match the same request.


Replies (1)

RE: conditional configuration documentation - Added by gstrauss almost 8 years ago

Thanks, dmrzzz. You intuition is correct.

My attempt at explaining lighttpd config merging can be found at: