Welcome! Log In Create A New Profile

Advanced

X-Accel-Redirect in LUA?

Posted by Richard Kearsley 
Richard Kearsley
X-Accel-Redirect in LUA?
July 23, 2012 10:20AM
Hi
Is it possible to trigger an X-Accel-Redirect from within lua code?

Example:

location /
{
# lua code should trigger X-Accel-Redirect to either location1 or location2? Somehow??
access_by_lua_file /home/nginx/conf/nginx.lua;

# if it hasn't set X-Accel-Redirect, proxy to some other server - important
proxy_pass http://10.0.0.2;
}

location /location1 {
internal;
root /var/www/loc1;
}

location /location2 {
internal;
root /var/www/loc2;
}



Richard Kearsley
Systems Developer | M247 Limited
Internal Dial 2210 | Mobile +44 7970 621236

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
pavelvasev
Re: X-Accel-Redirect in LUA?
January 09, 2017 08:30AM
Have you found a solution for this, Richard?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,228856,271867#msg-271867

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Richard Kearsley
Re: X-Accel-Redirect in LUA?
January 09, 2017 10:20AM
Hi
Yes, use ngx.exec in lua

On 09/01/17 07:23, pavelvasev wrote:
> Have you found a solution for this, Richard?
>
> Posted at Nginx Forum: https://forum.nginx.org/read.php?2,228856,271867#msg-271867
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
pavelvasev
Re: X-Accel-Redirect in LUA?
January 09, 2017 11:00AM
Thank you, Richard!

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,228856,271874#msg-271874

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login