Skip to content

Instantly share code, notes, and snippets.

@hoang-tranviet
Created July 11, 2017 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoang-tranviet/1417592ee3cd51c06e6cd7493184f351 to your computer and use it in GitHub Desktop.
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
# (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