Skip to content

Instantly share code, notes, and snippets.

@kazuho
Created December 3, 2015 00:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuho/b10099d2a5cb723fd2ca to your computer and use it in GitHub Desktop.
Save kazuho/b10099d2a5cb723fd2ca to your computer and use it in GitHub Desktop.
hosts:
"default":
listen:
port: 8081
ssl:
certificate-file: examples/h2o/server.crt
key-file: examples/h2o/server.key
paths:
/assets:
file.dir: htdocs/assets
/search:
file.dir: htdocs/search
/no-push/assets:
file.dir: htdocs/assets
/no-push/search:
file.dir: htdocs/search
/:
mruby.handler: |
lambda do |env|
push_paths = []
if /(\/|\.html)$/.match(env["PATH_INFO"])
push_paths << "/search/jquery-1.9.1.min.js"
push_paths << "/search/oktavia-jquery-ui.js"
push_paths << "/search/oktavia-english-search.js"
push_paths << "/assets/style.css"
push_paths << "/assets/searchstyle.css"
end
return [399, push_paths.empty? ? {} : {"link" => push_paths.map{|p| "<#{p}>; rel=preload"}.join("\n")}, []]
end
proxy.reverse.url: http://127.0.0.1:8082/
"/no-push":
proxy.reverse.url: http://127.0.0.1:8082/
access-log:
format: '%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i" "push:%{x-http2-push}o" "%{connect-time}x,%{request-total-time}x,%{request-header-time}x,%{request-body-time}x,%{process-time}x,%{response-time}x,%{duration}x"'
path: /dev/stdout
http2-casper: ON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment