-
Notifications
You must be signed in to change notification settings - Fork 0
Script variables in LoadFromFile configuration
Documentation is prelimary, the change for actually adding this is pending review (as is this documentation)
XXX adds support for script variables in pagespeed LoadFromFileXXX configuration entries. Script support for those options makes it possible to configure a generic mapping of http hosts to disk, to reduce the amount of configuration required when you want to load as much from disk as possible but have a lot of server{}
blocks.
When ProcessScriptVariables
is turned on, $
is reserved for declaring script variables in LoadFromFileXXX
lines. If you need $
in such configuration lines, you have to write $ps_dollar
instead,
so pre-existing configuration needs to be scanned before turning on ProcessScriptVariables
.
Processing of pagespeed configuration with script variables is deferred to request execution time, and lines containing script variables inherit downwards from http to server and from server to location by being prepended to the most specific configuration lines. Being executed at request time means that lines containing script variables will currently always override script lines without variables, as they are evaluated last. However, it is possible to specialize with non-scripted configuration by clearing all inherited scripts with adding "pagespeed ClearInheritedScripts;"
http {
...
pagespeed ProcessScriptVariables on;
# Generic mapping using script variables
pagespeed LoadFromFile "http://$host/" "$document_root";
# Note that we use the $ps_dollar escape to get '$'
pagespeed LoadFromFileRuleMatch Disallow \.ssp.css$ps_dollar;
# this server will use the scripted LoadFromFile configuration
server {
}
# This server specializes and will not use LoadFromFile
# It could add LoadFromFile configuration with or without script variables,
# and then that would be used instead
server {
...
pagespeed ClearInheritedScripts;
}
}
Currently support for script variables is constrained to LoadFromFileXXX