9951 explained code solutions for 126 technologies


nginx-luaHow to do internal redirect


server {
  location /test {
   content_by_lua_block {
      ngx.exec("@files")
   }
  }
  
  location @files {
   content_by_lua_block {
    ngx.say('helo after internal redirect')
   }
  }
}ctrl + c
content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.exec

does internal redirect to other Nginx location

@files

named location to redirect internally to

ngx.say

output given text to client