# X-Accel-Redirect in LUA?

**URL:** <https://www.ruby-forum.com/t/x-accel-redirect-in-lua/221621>\
**Category:** NGINX\
**Created:** [July 23, 2012, 10:15am UTC](https://www.ruby-forum.com/t/x-accel-redirect-in-lua/221621 "2012-07-23T10:15:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [July 23, 2012, 10:15am UTC](https://www.ruby-forum.com/t/x-accel-redirect-in-lua/221621/1 "2012-07-23T10:15:28Z")

</div>

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](http://10.0.0.2);  
}

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

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

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