Last active
August 29, 2015 14:26
-
-
Save kiyor/5bd62c704ead46e2bbdf to your computer and use it in GitHub Desktop.
nginx_lua_ubyk
This file contains hidden or 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
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; | |
} | |
} |
This file contains hidden or 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
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