I want to proxy requests to the backend_old server and process them with lua script. My nginx config:
upstream backend_old {
server backend_old.com:443;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
location = /mypath {
mirror /mirror;
mirror_request_body on;
proxy_pass https://backend_old/1.0/path;
}
location = /mirror {
internal;
access_by_lua_block {
ngx.exit(ngx.HTTP_FORBIDDEN)
}
}
}
I see data request completed to old_backend:
[11/Jan/2022:23:59:32 +0000] 127.0.0.6 - - - _ to: 184.72.39.201:443: POST /mypath HTTP/1.1 upstream_response_time 0.088 msec 1641945572.657 request_time 0.087
enter code here
But mirror fails with:
2022/01/11 23:59:32 [error] 481#481: *158 open() "/usr/local/openresty/nginx/html/mirror" failed (2: No such file or directory), client: 127.0.0.6, server: _, request: "POST /mypath HTTP/1.1", subrequest: "/mirror", host: myhost
any ideas on how I can configure /mirror
location properly?