<% is_first = true %> vcl 4.0; # generated varnish config: <%= ENVIRONMENT %> # local test: <%= LOCAL_TEST_MODE ? 'ENABLED' : 'DISABLED' %> sub vcl_recv { std.log("pre varnish log info '<%= domain.name %>':" + req.http.host); if (req.http.host ~ "<%= domain.name %>$") { std.log("varnish log info '<%= domain.name %>':" + req.http.host); <% domain.subdomains.each_pair do |subdomain_name, subdomain| %> <% unless '_general'.eql? subdomain_name %><%= is_first ? '' : 'else ' %>if (req.http.host ~ "^<%= subdomain.name %>.<%= domain.name %>$") {<% end %> std.log("subdomain identified '<%= subdomain.name %>.<%= domain.name %>':" + req.http.host + " url: " + req.url ); <% subdomain.assets.each_pair do |url, page| %> if (req.url ~ "^<%= prepare_url url %>") { std.log("page identified '<%= subdomain.name %>.<%= domain.name %>' Page:'<%= url %>':" + req.url); set req.backend_hint = <%= page.director %>.backend(); <% unless page.plugin_url.nil? %>set req.url = "<%= page.plugin_url %>";<% end %> return (hash); } <% end %> <% unless '_general'.eql? subdomain_name %> } <% is_first = false %> <% end %> <% end %> } }