Skip to content

Instantly share code, notes, and snippets.

@leafo
Created August 23, 2014 00:13
Show Gist options
  • Save leafo/efa94ae9e6e53bc202db to your computer and use it in GitHub Desktop.
Save leafo/efa94ae9e6e53bc202db to your computer and use it in GitHub Desktop.
worker_processes 1;
error_log stderr notice;
daemon off;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
resolver 8.8.8.8;
location ~* ^/proxy_test/(.*?)/(.*) {
proxy_pass_request_headers off;
proxy_pass http://$1/$2;
}
location ~* ^/test/(.*?)/(.*) {
set $a $1;
set $b $2;
content_by_lua '
local url = "/proxy_test/" .. ngx.var.a .. "/" .. ngx.var.b
res = ngx.location.capture(url)
ngx.header.content_type = "text/plain"
ngx.say(res.status)
';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment