Skip to content

Instantly share code, notes, and snippets.

@modeverv
Created November 22, 2018 09:57
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 modeverv/644743977c435585623e29a51bf0f45c to your computer and use it in GitHub Desktop.
Save modeverv/644743977c435585623e29a51bf0f45c to your computer and use it in GitHub Desktop.
H2Oを実戦投入するためのいろいろ ref: https://qiita.com/lovesaemi/items/1c72a3c54b3a7f928c7e
mruby.handler: |
require "htpasswd.rb"
Htpasswd.new("/path/to/.htpasswd", "Realm")
192.168.1.10
127.0.0.1
ALLOW_IPS = %w{
192.168.1.10
127.0.0.1
}
class Acl
def call(env)
if ALLOW_IPS.include? env['REMOTE_ADDR']
[399, {}, []]
else
[403, {'Content-Type' => 'text/plain;charset=utf-8'}, ['Forbidden']]
end
rescue => e
$stderr.puts e
end
end
Acl.new
paths:
"/":
mruby.handler-file: /path/to/ip.rb
file.dir: /var/www/html
paths:
"/":
mruby.handler: |
acl {
deny { path =~ /\.git+/ }
deny { path =~ /\.ht+/ }
}
file.dir: /var/www/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment