I'm trying to configure nginx (0.7.65) so it'll proxy to server A, and if it gets 404 will try to proxy to server B.
I've tried the following, but it doesn't work. Any ideas?
server {
error_log /tmp/nginx.error.log;
access_log /tmp/nginx.access.log;
listen 4433;
server_name localhost;
location / {
proxy_pass http://localhost:5984;
error_page 404 = @fallback;
}
location @fallback {
proxy_pass http://localhost:5983;
}
}
Nginx is an open source web server that can also serve as a reverse proxy.
A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network and directs client requests to the appropriate backend server. A reverse proxy provides an additional level of abstraction and control to ensure the smooth flow of network traffic between clients and servers.
Nginx is often used as a load balancer, a reverse proxy, and an HTTP Cache, among other uses. In this tutorial, we are focusing on learning how to use it as a forward proxy for any requested location.
proxy_intercept_errors on;
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