Skip to content

Instantly share code, notes, and snippets.

@negima1976
Last active January 13, 2016 06:21
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 negima1976/60da82065634419168c2 to your computer and use it in GitHub Desktop.
Save negima1976/60da82065634419168c2 to your computer and use it in GitHub Desktop.
Deny a connection other than the specific request method.
lambda do |env|
if /^(GET|POST|HEAD)/.match(env(["REQUEST_METHOD"]))
return [200, {},[]]
end
[405, {'content-type' => 'text/plain'}, ["Method Not Allowed\n"]]
end
@negima1976
Copy link
Author

h2o Mruby Directives

mruby.handler-file: /path/to/mruby-request-method-hanlder.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment