Facebook SDK is the most heavy file of all my website. It require about 5sec to load.
This is because Cache-control is set to 389sec. Do know a way to extend it to at least a week? Could be a good practice to insert all.js into my "asset pipeline" and set cache expire by fingerprint?
FacebookSDK.js.coffee
initializeFacebookSDK = ->
FB.init
channelUrl : '//website.herokuapp.com/page/fbchannel'
cookie : true
xfbml : true
status : false
oauth : false
PageController
class PageController < ApplicationController
def fbchannel
cache_expire = 1.year
response.headers["Pragma"] = "public"
response.headers["Cache-Control"] = "max-age=#{cache_expire.to_i}"
response.headers["Expires"] = (Time.now + cache_expire).strftime("%d %m %Y %H:%I:%S %Z")
render :layout => false, :inline => "<script src='//connect.facebook.net/it_IT/all.js'></script>"
end
end