Le Thu, 18 Apr 2013 11:29:29 -0400, Rich Bowen <rbo...@rcbowen.com> a écrit :
> > On Apr 18, 2013, at 11:09 AM, Igor Galić wrote: > > > From an IRC conversation in #httpd and #httpd-dev emerged the > > idea to interpolate %{variables} in all directives. > > According to sf we have somewhere a ~10 line code fragment > > which does that without much overhead (not benchmarked) when > > interpolating and with hardly any (short-circuit) when not. > > > > I think it would be a good idea to allow for this to be used > > in all directives (across all modules) it makes for immensly > > more readable configurations because: > > > > Example: > > > > # default vhost redirecting every HTTP vhost to HTTPS: > > <VirtualHost *:80> > > Redirect / https://%{HTTP_HOST}/ > > </VirtualHost> > > > > > > Another example might be something "more advanced" like: > > > > # group specific authorization: > > <LocationMatch "^/(?P<group>[^/]+).*"> > > Require group %{group} > > </Location> > > This would be lovely, and make us as cool as nginx. > > Problems to address include conflicts with mod_macro, mod_rewrite, > and any third-party module which might do variable fu. > > Having the interpolation ignore stuff starting with Rewrite* or in a > mod_macro definition seems simple enough. Having a generic way for a > third-party module to say "don't interpolate me, man!" could be handy > too. > Hi, I see no reason why it should be enabled per module, as I guess some admins might want it for some parts of config, and not others (including the .htaccess performance parsing point). How about introducing a new <Interpolate> context ? Default : off Possibly a "AllowOverride Interpolate", so the main admin decides whether .htaccess can make the server really slow. Also solves the rewrite/macro conflicts issues at the config level : <Interpolate On> <Directory /foo/bar> ... interpolated stuff </Directory> </Interpolate> <Interpolate Off> <Directory /foo/bar> ... My rewrite/macro/etc stuff </Directory> </Interpolate> This would also be fully compatible with 2.X existing configs and respect their behaviour as long as nothing is changed. Last point, who knows, maybe using interpolation together with mod_macro/mod_rewrite will be the next great thing that we didn't think of, and this config will even let super clever admins invent it for us ;) I suppose this might require more work to implement, though. Vincent -- Stop chasing shadows, just enjoy the ride. Morcheeba