If nginx is configured as a reverse proxy, could the following bit of configuration (counter-intuitively) cause a performance hit?
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
This checks if a file exists, then serves it and finishes the request. However, this may cause some I/O to happen. If that file system is slow, might it be possible that forwarding the request to the proxied service ends up being faster?
Just like @mlbright said, if
is bad, try to avoid it as much as you can, a good equivalent for the case you want to handle would be
location /whatever {
try_files $uri @app_server;
}
location @app_server {
proxy_pass http://app_server;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With