From 93283331eab3d4084e6f9b88553ce1e682d6b263 Mon Sep 17 00:00:00 2001 From: Nick Chapman Date: Sun, 26 Apr 2015 17:36:25 -0700 Subject: [PATCH] Added expire headers for 1 day --- app/controllers/embedly_controller.rb | 3 +++ app/controllers/favicons_controller.rb | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/controllers/embedly_controller.rb b/app/controllers/embedly_controller.rb index 010fa6b..c83bf41 100644 --- a/app/controllers/embedly_controller.rb +++ b/app/controllers/embedly_controller.rb @@ -11,6 +11,9 @@ def extract $redis.expire(request_hash, 1.day) end + # ask client to cache for one day + response.headers['Expires'] = 1.day.from_now.httpdate + render body: result, content_type: params[:callback] ? 'application/javascript' : 'application/json' end diff --git a/app/controllers/favicons_controller.rb b/app/controllers/favicons_controller.rb index da0aeb8..131f2df 100644 --- a/app/controllers/favicons_controller.rb +++ b/app/controllers/favicons_controller.rb @@ -5,6 +5,9 @@ def get fetch_favicon(params[:url]) end + # ask client to cache for one day + response.headers['Expires'] = 1.day.from_now.httpdate + send_data data.read, type: 'image/x-icon', disposition: 'inline' end