Project

General

Profile

Bug #41

closed

nested conditionals

Added by jan almost 16 years ago. Updated over 13 years ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

Allow and handle:


$HTTP["host"] == "www.example.org" {
  $HTTP["url"] =~ "^/base/" {
    ...
  }
}

#1

Updated by jan over 15 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

added by Xuefer in changeset r298 and ongoing

#2

Updated by Anonymous about 14 years ago

  • Status changed from Fixed to Need Feedback
  • Resolution deleted (fixed)

Nesting, the other way round ($HTTPhost inside $HTTPurl) doesn't work. See

http://forum.lighttpd.net/topic/2561

-- johannes.beigel

#3

Updated by Anonymous about 14 years ago

A similar problem exists with {{{ $HTTPhost }}} and {{{ $SERVERsocket }}}

This works:


$HTTP["host"] == "server" {
        $SERVER["socket"] == "IP:443" {
        # ...
        }
}

But this leads to a timeout in the web browser:


$SERVER["socket"] == "IP:443" {
        $HTTP["host"] == "server" {
        # ...
        }
}
#4

Updated by Anonymous almost 14 years ago

I have severe trouble with nested conditions. I have "hand made" virtual hosting like indicated below:


server.document-root = "/var/www/default" 
$HTTP["host"] =~ "^(host1|host2|host3|...)$" {
  server.document-root = "/var/www/real-content" 
  $HTTP["url"] =~ "^/_admin" {
     $HTTP["remoteip"] !~ "(^1.2.3.|172.16|172.17|172.18)" {
        url.access-deny = ( "" )
     }
     $SERVER["socket"] == "2.3.4.5:80" {
           url.redirect = ( "/.*" => "https://mgmthost/_admin/" )
     }
  }
}

$HTTP["host"] =~ "^host5$" {
 ... something else here...
}
$HTTP["url"] =~ "^/server.*" {
  $HTTP["remoteip"] != "1.2.3.0/24" {
    url.access-deny = ( "" )
  }
}

Observations:
  • The url.access-deny in the first clause is never executed. I can access the pages under `/_admin/` from anywhere.
  • The redirect is also never executed (SSL works fine if I happen to enter the correct https:// URL).
  • If I chain the conditions like this: `$HTTPhost {} else $HTTPremoteip { ... }`
    Then not even the server.document-root in the first $HTTP clause gets executed, and the whole virtual hosting breaks down in the process.
  • ANY attempt to limit the access to /server-status etc (see the last clause) was ignored, too. I was unable to figure out how to make it work, neither in global context, nor nested within something else.

Also, swapping the conditions didn't help any, too.

I'm a bit at a loss as to how to cope with this, and/or which bug(s) this should be (1, 2, something else?).

At least, I'd say that this bug is still valid.

#5

Updated by jan over 13 years ago

  • Status changed from Need Feedback to Fixed
  • Resolution set to fixed

fixed in r1792, r1795 and r1807

Also available in: Atom