Skip to content

Commit

Permalink
Updated so proxy pass match is first and unused if blank
Browse files Browse the repository at this point in the history
won't write config on undef
puts pass match ahead of pass rules
  • Loading branch information
Charlie Pitkin committed Aug 15, 2019
1 parent b029365 commit 4ad83b3
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions templates/vhost/_proxy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,35 @@
<% if @proxy_error_override -%>
ProxyErrorOverride On
<%- end -%>
<% [@proxy_pass_match].flatten.compact.each do |proxy| %>
<%- Array(proxy['no_proxy_uris']).each do |uri| -%>
ProxyPass <%= uri %> !
<%- end -%>
<%- Array(proxy['no_proxy_uris_match']).each do |uri| -%>
ProxyPassMatch <%= uri %> !
<%- end -%>
<%- if proxy['path'] and proxy['url'] -%>
ProxyPassMatch <%= proxy['path'] %> <%= proxy['url'] -%>
<% end -%>
<%- if proxy['params'] -%>
<%- proxy['params'].keys.sort.each do |key| -%> <%= key %>=<%= proxy['params'][key] -%>
<%- end -%>
<%- end -%>
<%- if proxy['keywords'] %> <%= proxy['keywords'].join(' ') -%>
<%- end %>
<%- if proxy['reverse_urls'].nil? and proxy['path'] and proxy['url']-%>
ProxyPassReverse <%= proxy['path'] %> <%= proxy['url'] %>
<%- else -%>
<%- Array(proxy['reverse_urls']).each do |reverse_url| -%>
ProxyPassReverse <%= proxy['path'] %> <%= reverse_url %>
<%- end -%>
<%- end -%>
<%- if proxy['setenv'] -%>
<%- Array(proxy['setenv']).each do |setenv_var| -%>
SetEnv <%= setenv_var %>
<%- end -%>
<%- end -%>
<% end -%>
<%- [@proxy_pass].flatten.compact.each do |proxy| -%>
<%- Array(proxy['no_proxy_uris']).each do |uri| -%>
ProxyPass <%= uri %> !
Expand Down Expand Up @@ -55,35 +84,6 @@
<%- end -%>
<%- end -%>
<% end -%>
<% if @proxy_pass_match != nil -%>
<% [@proxy_pass_match].flatten.compact.each do |proxy| %>
<%- Array(proxy['no_proxy_uris']).each do |uri| -%>
ProxyPass <%= uri %> !
<%- end -%>
<%- Array(proxy['no_proxy_uris_match']).each do |uri| -%>
ProxyPassMatch <%= uri %> !
<%- end -%>
ProxyPassMatch <%= proxy['path'] %> <%= proxy['url'] -%>
<%- if proxy['params'] -%>
<%- proxy['params'].keys.sort.each do |key| -%> <%= key %>=<%= proxy['params'][key] -%>
<%- end -%>
<%- end -%>
<%- if proxy['keywords'] %> <%= proxy['keywords'].join(' ') -%>
<%- end %>
<%- if proxy['reverse_urls'].nil? -%>
ProxyPassReverse <%= proxy['path'] %> <%= proxy['url'] %>
<%- else -%>
<%- Array(proxy['reverse_urls']).each do |reverse_url| -%>
ProxyPassReverse <%= proxy['path'] %> <%= reverse_url %>
<%- end -%>
<%- end -%>
<%- if proxy['setenv'] -%>
<%- Array(proxy['setenv']).each do |setenv_var| -%>
SetEnv <%= setenv_var %>
<%- end -%>
<%- end -%>
<% end -%>
<% end -%>
<% if @proxy_dest -%>
<%- Array(@no_proxy_uris).each do |uri| -%>
ProxyPass <%= uri %> !
Expand Down

0 comments on commit 4ad83b3

Please sign in to comment.