I know there are Nginx phases. Why does the following snippet deliver the "200 Host: example.com" instead of forwarding to Google? What would be a generally valid workaround to evaluate Lua higher or before?
server { listen 80; server_name example.com; location / { rewrite_by_lua_block { return ngx.redirect('https://www.google.com/', 303) } default_type text/plain; return 200 "Host: $host"; } } Maybe this doesn't make sense at first sight, but I have an intelligent way to block/redirect certain calls in the Lua block (or in a Lua file included at this point). This module should work in general. With proxy_pass, alias etc. it works fine. Only with return 200 it does not work. Does anyone have an idea?