Bug #2379
closedmixing url.rewrite and url.rewrite-once causes mess
Description
from docs it is said that url.rewrite
and url.rewrite-final
are identical (mapped to url.rewrite-once
in 1.3.16)
however mixing them and using concatenation (foo += bar
) causes mess if also virtualhost (or other) context are created
if you look the parse tree, they both presented as separate keywords (imho should be listed as in one list, aka url.rewrite-final
). and in virtualhost only that list becames "visible" who is appeneded to, thus the "other" one is missing.
this config and output should explain it:
lighttpd-test.conf
:
server.modules = ( "mod_rewrite", "mod_cgi", ) url.rewrite += ( "^/ccc/ws/([^/]+)/c/([^/|\?]+)(\?(.*))?" => "/ccc/webservice.php?d=$1&c=$2&$4", ) url.rewrite-once += ( "^/scms/([bfg]=.+)" => "/scms/server.php?$1", ) $HTTP["host"] == "prooty.delfi.lan" { url.rewrite-once += ( "prooty" => "1", ) } $HTTP["host"] == "tfooty.delfi.lan" { url.rewrite += ( "tfooty" => "1", ) }
# lighttpd -pf lighttpd-test.conf
:
config { var.PID = 1389 var.CWD = "/etc/lighttpd" server.modules = ("mod_indexfile", "mod_rewrite", "mod_cgi", "mod_dirlisting", "mod_staticfile") url.rewrite = ( "^/ccc/ws/([^/]+)/c/([^/|\?]+)(\?(.*))?" => "/ccc/webservice.php?d=$1&c=$2&$4", ) url.rewrite-once = ( "^/scms/([bfg]=.+)" => "/scms/server.php?$1", ) $HTTP["host"] == "prooty.delfi.lan" { # block 1 url.rewrite-once = ( "^/scms/([bfg]=.+)" => "/scms/server.php?$1", "prooty" => "1", # 2 ) } # end of $HTTP["host"] == "prooty.delfi.lan" $HTTP["host"] == "tfooty.delfi.lan" { # block 2 url.rewrite = ( "^/ccc/ws/([^/]+)/c/([^/|\?]+)(\?(.*))?" => "/ccc/webservice.php?d=$1&c=$2&$4", "tfooty" => "1", # 2 ) } # end of $HTTP["host"] == "tfooty.delfi.lan" }
Updated by stbuehler almost 13 years ago
"+=" is evaluated in the config parser, which doesn't know which keys might be identical.
lighttpd -pf
shows how the config looks after parsing, and what the modules will see.
So you should stick to one name; I have no good ideas how to fix that (the config parser can't know which names are the same, as the modules are loaded after the config is parsed).
Also having url.rewrite and url.rewrite-once in the same block is not a good idea; it will combine them, but possibly in an unexpected order. In different blocks the last block will overwrite the previous blocks.
Also available in: Atom