Reputation: 159
I use OpenResty in my project and faced issue that nginx ignores access_by_lua_file when use proxy pass. Here is my code of location:
location /getapi {
internal;
set $apiauth '';
set $api_host '';
access_by_lua_file /usr/local/openresty/nginx/conf/lua/getapi.lua;
proxy_redirect default;
proxy_pass $api_host;
proxy_ssl_certificate "/usr/local/openresty/nginx/conf/cert.pem"
certificate_key "cert.key";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Authorization $apiauth;
}
I call this location with ngx.location.capture
. In lua file i define variables apiauth
and api_host
. But contents of lua file never executes, nginx just ignores it. And no errors in error.log. The only one is that i try to GET empty URL. How can i force nginx to execute contents of access_by_lua_file
?
Upvotes: 1
Views: 1697