chaoslawful/lua-nginx-module — Issue #67: ngx.exec is broken in master
Author: utros
Created: 2011-11-16 12:57:51+00:00
State: open

Minimized example:
server {
listen 8080;
server_name _;
location / {
default_type text/plain;
content_by_lua 'ngx.say(ngx.var.request_uri)
ngx.say(ngx.var.uri)';
}
}
upstream backend {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name localhost;
rewrite_log on;
log_subrequest on;

location /show/ {
proxy_pass http://backend;
}

location /t1/ {
access_by_lua 'ngx.exec("/show/")';
proxy_pass http://example.com;
}

location /t2/ {
access_by_lua 'ngx.set_uri("/show/")
ngx.exec("/show/")';
proxy_pass http://example.com;
}
}

What's happening?
t1: internal redirect performs ok, but url stays the same
$ curl localhost/t1/
/t1/
/t1/
t2: everything lokks fine
$ curl localhost/t2/
/show/
/show/

Sometimes dirty hack in /t2/ doesn't work too.