Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/templates/varnish/vhost.vcl.erb
Show All 10 Lines | |||||
<% end -%> | <% end -%> | ||||
req.http.host ~ "^(?i)<%= Regexp.escape(@servername) %>(:[0-9]+)?$" | req.http.host ~ "^(?i)<%= Regexp.escape(@servername) %>(:[0-9]+)?$" | ||||
) { | ) { | ||||
var.set("known-vhost", "yes"); | var.set("known-vhost", "yes"); | ||||
if (std.port(server.ip) == <%= scope['::profile::varnish::http_port'] %>) { | if (std.port(server.ip) == <%= scope['::profile::varnish::http_port'] %>) { | ||||
set req.http.x-redir = "https://" + req.http.host + req.url; | set req.http.x-redir = "https://" + req.http.host + req.url; | ||||
return(synth(850, "Moved permanently")); | return(synth(850, "Moved permanently")); | ||||
} else { | } else { | ||||
set req.backend_hint = <%= @backend_name %>; | |||||
<%- if @basic_auth -%> | <%- if @basic_auth -%> | ||||
if ( 1 == 1 # noop expression to be syntactically correct with the following && | if ( 1 == 1 # noop expression to be syntactically correct with the following && | ||||
<%- @basic_auth_strings.each do | basic_auth_string | -%> | <%- @basic_auth_strings.each do | basic_auth_string | -%> | ||||
&& ! req.http.Authorization ~ "Basic <%= basic_auth_string %>" | && ! req.http.Authorization ~ "Basic <%= basic_auth_string %>" | ||||
<%- end -%> | <%- end -%> | ||||
) { | ) { | ||||
return(synth(401, "Restricted")); | return(synth(401, "Restricted")); | ||||
} | } | ||||
<%- end -%> | <%- end -%> | ||||
<% if @websocket_support -%> | <% if @websocket_support -%> | ||||
if (req.http.upgrade ~ "(?i)websocket") { | if (req.http.upgrade ~ "(?i)websocket") { | ||||
return (pipe); | return (pipe); | ||||
} | } | ||||
<% end -%> | <% end -%> | ||||
set req.http.X-Forwarded-Proto = "https"; | set req.http.X-Forwarded-Proto = "https"; | ||||
set req.backend_hint = <%= @backend_name %>; | |||||
} | } | ||||
<% if @vcl_recv_extra -%> | <% if @vcl_recv_extra -%> | ||||
<%= @vcl_recv_extra %> | <%= @vcl_recv_extra %> | ||||
<% end -%> | <% end -%> | ||||
} | } | ||||
} | } | ||||
<% if @websocket_support -%> | <% if @websocket_support -%> | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |