Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matsumotory/mod_mruby_reverse_proxy
Reverse Proxy by mod_mruby
https://github.com/matsumotory/mod_mruby_reverse_proxy
Last synced: about 2 months ago
JSON representation
Reverse Proxy by mod_mruby
- Host: GitHub
- URL: https://github.com/matsumotory/mod_mruby_reverse_proxy
- Owner: matsumotory
- Created: 2013-04-12T00:26:28.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-12T10:41:23.000Z (almost 12 years ago)
- Last Synced: 2024-10-18T18:28:30.639Z (3 months ago)
- Size: 105 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Porxy Module by mod_mruby
Proxy Module using mod_mruby.
- mrbgem dependency for mod_mruby
`Nothing`
## How to Use
- Intall mod_mruby previouslySee https://github.com/matsumoto-r/mod_mruby
- Copy conf
```bash
cp mod_mruby_proxy.conf ${HTTPD_ROOT}/conf.d/.
```- Change mod_mruby_proxy.conf for you
```apache
# simple proxy module
mrubyTranslateNameFirst /path/to/proxy.rb
# proxy modul by scoreboard information
#mrubyTranslateNameFirst /path/to/proxy_by_scboard.rb
```- Change /path/to/proxy_by_scboard.rb for you
```ruby
backends = [
"http://192.168.0.101:8888/",
"http://192.168.0.102:8888/",
"http://192.168.0.103:8888/",
"http://192.168.0.104:8888/",
]
# この辺に色々条件を入れたり、backends配列から取り出すルールを別途定義したりするとmod_mrubyのうまみがでる?
r = Apache::Request.new
r.handler = "proxy-server"
r.proxyreq = Apache::PROXYREQ_REVERSE
r.filename = "proxy:" + backends[rand(backends.length)] + r.uri
Apache.return Apache::OK
```- httpd restart
```bash
service httpd restart
```