Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(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
You can’t perform that action at this time.