Project

General

Profile

Bug #41

nested conditionals

Added by jan over 14 years ago. Updated over 12 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
core
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Missing in 1.5.x:

Description

Allow and handle:


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

Associated revisions

Revision 1807 (diff)
Added by jan over 12 years ago

fixed failing nesting and else-handling introduced in the last changes
(fixes #41)

Revision 3940c60e (diff)
Added by jan about 12 years ago

fixed aggressive caching of conditionals (#41)

$HTTP["url"] =~ "" { cgi.assign = ... } fails if there is a module
loaded which is called before uri_clean is set (mod_exforward,
mod_rewrite, ...)

- merged [1792], [1798], [1807], [1810], [1811] from trunk

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1942 152afb58-edef-0310-8abb-c4023f1b3aa9

History

#1

Updated by jan over 14 years ago

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

added by Xuefer in changeset r298 and ongoing

#2

Updated by Anonymous almost 13 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 almost 13 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 over 12 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 12 years ago

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

fixed in r1792, r1795 and r1807

Also available in: Atom