-
-
Save k4zuki02h4t4/193b1627f15085e9e7a0333185909f8d to your computer and use it in GitHub Desktop.
Revisions
-
tomfuertes revised this gist
May 6, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ class ApplicationController < ActionController::Base after_action :server_push_headers # https://twitter.com/connorjshea/status/728472354385317888 def server_push_headers # CLoudflare HTTP2 Server Push: https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/ -
tomfuertes revised this gist
May 6, 2016 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ class ApplicationController < ActionController::Base after_filter :server_push_headers def server_push_headers # CLoudflare HTTP2 Server Push: https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/ if request.format.html? # only on html pages @@ -17,3 +21,5 @@ def server_push_headers end end end end -
tomfuertes created this gist
May 6, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ def server_push_headers # CLoudflare HTTP2 Server Push: https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/ if request.format.html? # only on html pages layout = self.send(:_layout) # with the right layout if layout == "main" || layout == "speaker" || layout == "admin" assets = [ "<#{view_context.asset_path('application.css')}>; rel=preload; as=style", "<#{view_context.asset_path('application.js')}>; rel=preload; as=script", "<#{view_context.asset_path("twitter/bootstrap/glyphicons-halflings.png")}>; rel=preload; as=image", "<#{view_context.asset_path("site/#{site.code}/logo.png")}>; rel=preload; as=image", ] assets.push([ "<#{view_context.asset_path("ppc/check.png")}>; rel=preload; as=image", "<#{view_context.asset_path("icons/ratings/star-off.png")}>; rel=preload; as=image", ]) if params[:controller] == 'speakers' && params[:action] == 'show' response.headers['Link'] = assets end end end