Skip to content

Instantly share code, notes, and snippets.

@kiyor
Last active August 29, 2015 14:26
Show Gist options
  • Save kiyor/5bd62c704ead46e2bbdf to your computer and use it in GitHub Desktop.
Save kiyor/5bd62c704ead46e2bbdf to your computer and use it in GitHub Desktop.
nginx_lua_ubyk
server {
listen 80;
server_name yourservername;
charset UTF-8;
location ~ ^/p($|roxy$) {
default_type 'application/x-ns-proxy-autoconfig';
lua_code_cache on;
content_by_lua_file '/usr/local/nginx/conf/lua/proxy.lua';
}
location = /proxy.pac {
proxy_pass http://yo.uku.im/proxy.pac;
}
}
req = "/proxy.pac"
local resp = ngx.location.capture(req)
local res = string.gsub(resp.body, "proxy.uku.im", "10.7.0.1")
ngx.say(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment