From 3754b038e89340d62ffeaada5a9e1470dd437e72 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Thu, 23 Feb 2017 18:26:40 -0500 Subject: [PATCH] fix brotli origin --- app/controllers/static_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index fe0fb1ffead..90e8b498594 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -147,12 +147,11 @@ class StaticController < ApplicationController return end - response.headers["Expires"] = 1.year.from_now.httpdate - response.headers["Cache-Control"] = 'max-age=31557600, public' response.headers["Content-Encoding"] = 'br' + # disable NGINX mucking with transfer + request.env['sendfile.type'] = '' immutable_for 1.year - send_file(path, opts) end @@ -178,6 +177,8 @@ class StaticController < ApplicationController opts = { disposition: nil } opts[:type] = "application/javascript" if path =~ /\.js$/ + immutable_for(1.year) + # we must disable acceleration otherwise NGINX strips # access control headers request.env['sendfile.type'] = ''