Open Resty the Prebuilt Reverse Proxy
Open Resty the Prebuilt Reverse Proxy

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

workerprocesses  1;   # we could enlarge this setting on a multi-core machine
errorlog  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

Hope this was helpful. If so, feel free to checkout my YouTube channel, get updates when a new article is posted by following on Feedly and read the the other guides at nathan.vertile.com/blog
comments powered by Disqus