about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-03-13 21:21:45 -0500
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:21 -0500
commit758deeb818ab4a7fa114f6f1dac53ded8139e713 (patch)
treef2148778da83426f12ff2eb13e9b3889ac170a95 /config/initializers
parent312bc14d06c7fc46d4b63024de2a6d02acae2d98 (diff)
update csp for img proxy
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/content_security_policy.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb
index 2fe1a33fa..d591818e8 100644
--- a/config/initializers/content_security_policy.rb
+++ b/config/initializers/content_security_policy.rb
@@ -16,6 +16,7 @@ if Rails.env.production?
     attachments_host = nil
   end
 
+  img_proxy_host = "https://#{ENV.fetch('IMG_PROXY_DOMAIN', assets_host)}"
   data_hosts << attachments_host unless attachments_host.nil?
 
   if ENV['PAPERCLIP_ROOT_URL']
@@ -31,7 +32,7 @@ if Rails.env.production?
     p.frame_ancestors :none
     p.script_src      :self, assets_host
     p.font_src        :self, assets_host
-    p.img_src         :self, :data, :blob, *data_hosts
+    p.img_src         :self, :data, :blob, img_proxy_host, *data_hosts
     p.style_src       :self, :unsafe_inline, assets_host
     p.media_src       :self, :data, *data_hosts
     p.frame_src       :self, :https