Do you ever wish you had a bulletproof programmable reverse proxy?
Maybe you want to pull a Cloudflare and cache some content or do some magic wildcard ssl-ing.
It used to be you had to write you own Node.js based reverse proxy or figure out how to build nginx with lua and other-module support.
Well fret no longer. Open Resty is here.
I admit, the docs are odd and it's maintained by some dudes in China. That said, it's awesome.
If you're on a mac you can homebrew from my recipe with these commands:
brew tap nathantsoi/homebrew-resty brew install open-resty
Once you've brewed up, grab an example script such as this one:
mycoolprogram.conf
worker_processes 1; # we could enlarge this setting on a multi-core machine
error_log logs/error.log warn;
events {
worker_connections 128;
}
http {
server {
listen 8080;
server_name localhost;
location = / {
content_by_lua '
foo.say("hello, awesome!")
';
}
}
}
and run it:
openresty -c pwd/mycoolprogram.conf