Created
July 11, 2017 06:42
-
-
Save hoang-tranviet/1417592ee3cd51c06e6cd7493184f351 to your computer and use it in GitHub Desktop.
(nghttpx proxy) mruby script to add Link preload header into normal response
This file contains 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 characters
# (on nghttpx proxy) | |
# mruby script to add Link preload header into normal response | |
# To execute: | |
# ./src/nghttpx --mruby-file ./200-add-preload.rb --frontend="localhost,3000;no-tls" -L INFO | |
class App | |
def on_req(env) | |
req = env.req | |
return if req.method != 'GET' | |
resp = env.resp | |
#path = req.path | |
# if path == '/?103-eh' || path == '/index.html?103-eh' | |
resp.add_header 'link', '</stylesheets/screen.css>;rel=preload' | |
return | |
# end | |
end | |
end | |
App.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment