Sha256: 3e6b4bc530a9344bf85b3b3867ae6f7ed4af24382bf1d6da411c6414463cb1c6

Contents?: true

Size: 1.55 KB

Versions: 8

Compression:

Stored size: 1.55 KB

Contents

<%
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);

		# subdomains
		<% domain.subdomains.each_pair do |subdomain_name, subdomain| %>
			<% next if '_general'.eql? subdomain_name %>
			<%= is_first ? '' : 'else ' %>if (req.http.host ~ "^<%= subdomain.name %>.<%= domain.name %>$") {
				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 %>

			}
			<% is_first = false %>
		<% end %>

		# general
		<% subdomain = domain.subdomain('_general') %>
		<% 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 %>
	}
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
odania-0.0.32 templates/varnish/site_assets.vcl.erb
odania-0.0.31 templates/varnish/site_assets.vcl.erb
odania-0.0.30 templates/varnish/site_assets.vcl.erb
odania-0.0.29 templates/varnish/site_assets.vcl.erb
odania-0.0.28 templates/varnish/site_assets.vcl.erb
odania-0.0.27 templates/varnish/site_assets.vcl.erb
odania-0.0.26 templates/varnish/site_assets.vcl.erb
odania-0.0.25 templates/varnish/site_assets.vcl.erb