Feature #810
closedMake regex conditional in $HTTP[] usable for all variables within scope
Description
As it is now, i can reuse the matches for redirect and rewrite in a similar fashion (picked from example conf):
{{{
$HTTPhost =~ "^www\.(.*)" {
url.redirect = ( "^/(.*)" => "http://%1/$1" )
}
}}}
I would like to use the matches for other variables too - for example server.document-root. This would allow for a very flexible virtual host.
-- Lfe
Updated by Anonymous over 18 years ago
I would love to see this as well
-- altano
Updated by moo over 18 years ago
server.document-root can be the first one to go, i think...
Updated by Anonymous over 18 years ago
Updated by moo over 18 years ago
sorry, go with the url.redirect way, not "be gone".
it has been discussed before, we wonder how much config should support this, as it as to be coded one by one.
Updated by Anonymous almost 18 years ago
An alternative approach can be found in #1194 - not nearly as flexible though since it only gives you the ability to change the docroot.
-- Lfe
Updated by Anonymous almost 18 years ago
Replying to Lfe:
An alternative approach can be found in #1194 - not nearly as flexible though since it only gives you the ability to change the docroot.
That would work for some setups but I'm using lighttpd as a proxy server, so it wouldn't work for me.
Or rather, I'm still waiting for 1.5 so that I can use it as a proxy server :)
Thanks for the heads up though.
Updated by blueyed over 17 years ago
- server.document-root
- server.errorlog
- accesslog.filename
Maybe also server.username and server.groupname.
Without knowing the source it may be possible to implement it for all <string> values inside a conditional (e.g. as a wrapper around buffer_copy_string_buffer)!?
This would also allow to use it for own variables, e.g. var.myvar = "%2".
Updated by moo over 17 years ago
i would have done it already if it's easy
support it in var.myvar is meanless, because var.myvar is at parsed not runtime, which mean the var does not exists at runtime. it's like cpp (c preprocessor) if you konw.
but if something support %2, var.myvar will "support" it indirectly:
#!lighttpdconf var.myvar="%2" $HTTP[..] =~ "..." { url.redirect=("/" + var.myvar => "....") }
is exactly equal to
#!lighttpdconf $HTTP[..] =~ "..." { url.redirect=("/%2" => "....") }
Updated by blueyed over 17 years ago
Ok. I understand. Thanks for explaining.
What about supporting the $HTTP "global" in general, instead of only the matched pattern from the outer scope?
I think the usecase for pattern matching in a condition is the same as if you were able use $HTTP which would get set dynamically for each request(?).
(see http://forum.lighttpd.net/topic/9975).
Updated by stbuehler over 16 years ago
- Status changed from New to Fixed
- Resolution set to wontfix
The lighttpd config is not a script language, and it would be stupid to invent a new one. Use mod_magnet.
Also available in: Atom