Project

General

Profile

Actions

Feature #810

closed

Make regex conditional in $HTTP[] usable for all variables within scope

Added by Anonymous over 17 years ago. Updated over 15 years ago.

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

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

Actions #1

Updated by Anonymous over 17 years ago

I would love to see this as well

-- altano

Actions #2

Updated by moo over 17 years ago

server.document-root can be the first one to go, i think...

Actions #3

Updated by Anonymous over 17 years ago

Replying to moo:

server.document-root can be the first one to go, i think...

"go" ?

Actions #4

Updated by moo over 17 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.

Actions #5

Updated by Anonymous almost 17 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

Actions #6

Updated by Anonymous almost 17 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.

Actions #7

Updated by blueyed over 16 years ago

I think it should get added for at least:
  • 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".

Actions #8

Updated by moo over 16 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" => "....")
}
Actions #9

Updated by blueyed over 16 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).

Actions #10

Updated by stbuehler over 15 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.

Actions #11

Updated by stbuehler over 15 years ago

  • Status changed from Fixed to Wontfix
Actions

Also available in: Atom