diff --git a/manifests/init.pp b/manifests/init.pp index d4bad2b..b8e8817 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -51,6 +51,7 @@ class zuul ( $proxy_ssl_cert_file_contents = '', $proxy_ssl_key_file_contents = '', $proxy_ssl_chain_file_contents = '', + $block_referers = [], ) { include apache include pip diff --git a/templates/zuul.vhost.erb b/templates/zuul.vhost.erb index b011487..d69904b 100644 --- a/templates/zuul.vhost.erb +++ b/templates/zuul.vhost.erb @@ -19,6 +19,10 @@ CustomLog ${APACHE_LOG_DIR}/<%= @vhost_name %>-access.log combined RewriteEngine on + <% @block_referers.each do |referer| -%> + RewriteCond %{HTTP_REFERER} =<%= referer %> + RewriteRule ^/status.json - [F] + <% end -%> RewriteRule ^/status.json$ http://127.0.0.1:8001/status.json [P] AddOutputFilterByType DEFLATE application/json @@ -79,6 +83,10 @@ CustomLog ${APACHE_LOG_DIR}/<%= @vhost_name %>-access.log combined RewriteEngine on + <% @block_referers.each do |referer| -%> + RewriteCond %{HTTP_REFERER} =<%= referer %> + RewriteRule ^/status.json - [F] + <% end -%> RewriteRule ^/status.json$ http://127.0.0.1:8001/status.json [P] AddOutputFilterByType DEFLATE application/json