From efd6bf149013bbe5190acd7c33f2981c31ab6e4e Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 8 Jul 2014 14:48:20 +1000 Subject: [PATCH] FIX: set last modified date on CDN assets --- app/controllers/static_controller.rb | 5 +++++ config/initializers/06-mini_profiler.rb | 1 + 2 files changed, 6 insertions(+) diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index 4d6ddde96f2..b62fd03b781 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -64,6 +64,11 @@ class StaticController < ApplicationController path = (Rails.root + "public/assets/" + path).to_s expires_in 1.year, public: true response.headers["Access-Control-Allow-Origin"] = params[:origin] + begin + response.headers["Last-Modified"] = File.ctime(path).httpdate + rescue Errno::ENOENT + raise Discourse::NotFound + end opts = { disposition: nil } diff --git a/config/initializers/06-mini_profiler.rb b/config/initializers/06-mini_profiler.rb index 66a2b86cf4b..5d486229c6b 100644 --- a/config/initializers/06-mini_profiler.rb +++ b/config/initializers/06-mini_profiler.rb @@ -27,6 +27,7 @@ if defined?(Rack::MiniProfiler) (path !~ /qunit/) && (path !~ /srv\/status/) && (path !~ /commits-widget/) && + (path !~ /^\/cdn_asset/) && (path !~ /^\/logs/) end