diff --git a/site-modules/profile/templates/varnish/vhost.vcl.erb b/site-modules/profile/templates/varnish/vhost.vcl.erb index 85866a0d..9e7ef8ac 100644 --- a/site-modules/profile/templates/varnish/vhost.vcl.erb +++ b/site-modules/profile/templates/varnish/vhost.vcl.erb @@ -1,45 +1,45 @@ # vhost_<%= @servername %>.vcl # # Settings for the <%= @servername %> vhost # # File managed by puppet. All modifications will be lost. sub vcl_recv { if ( <% @aliases.each do |alias_| -%> - req.http.host ~ "^(?i)<%= Regexp.escape(alias_) %>$" || + req.http.host ~ "^(?i)<%= Regexp.escape(alias_) %>(:[0-9]+)?$" || <% end -%> - req.http.host ~ "^(?i)<%= Regexp.escape(@servername) %>$" + req.http.host ~ "^(?i)<%= Regexp.escape(@servername) %>(:[0-9]+)?$" ) { if (std.port(server.ip) == <%= scope['::profile::varnish::http_port'] %>) { set req.http.x-redir = "https://" + req.http.host + req.url; return(synth(850, "Moved permanently")); } else { set req.http.X_FORWARDED_PROTO = "https"; set req.backend_hint = <%= @backend_name %>; } <% if @vcl_recv_extra -%> <%= @vcl_recv_extra %> <% end -%> } } <% if @hsts_max_age or @vcl_deliver_extra -%> sub vcl_deliver { if ( <% @aliases.each do |alias_| -%> - req.http.host ~ "^(?i)<%= Regexp.escape(alias_) %>$" || + req.http.host ~ "^(?i)<%= Regexp.escape(alias_) %>(:[0-9]+)?$" || <% end -%> - req.http.host ~ "^(?i)<%= Regexp.escape(@servername) %>$" + req.http.host ~ "^(?i)<%= Regexp.escape(@servername) %>(:[0-9]+)?$" ) { <% if @hsts_max_age -%> if (std.port(server.ip) != <%= scope['::profile::varnish::http_port'] %>) { set resp.http.Strict-Transport-Security = "max-age=<%= @hsts_max_age %>;"; } <% end -%> <% if @vcl_deliver_extra -%> <%= @vcl_deliver_extra %> <% end -%> } } <% end -%>