Created
November 22, 2018 09:57
-
-
Save modeverv/644743977c435585623e29a51bf0f45c to your computer and use it in GitHub Desktop.
H2Oを実戦投入するためのいろいろ ref: https://qiita.com/lovesaemi/items/1c72a3c54b3a7f928c7e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mruby.handler: | | |
require "htpasswd.rb" | |
Htpasswd.new("/path/to/.htpasswd", "Realm") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192.168.1.10 | |
127.0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
paths: | |
"/": | |
mruby.handler-file: /path/to/ip.rb | |
file.dir: /var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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