Welcome! Log In Create A New Profile


How to refuse connection when proxy_pass backend is down

Posted by dzoks 
How to refuse connection when proxy_pass backend is down
February 10, 2021 09:08AM
Hello guys. I have configured backend server for my application on port 8081.
On my other server443 port is open and I did setup on nginx to proxy_pass on port 8081. Configurations is as:

server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name mydomain.com;
ssl_certificate "/etc/pki/nginx/certificate.pem";
ssl_certificate_key "/etc/pki/nginx/private/private.key";
ssl_password_file "/etc/pki/nginx/private/phrase.t";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

location / {


It works great, but I have another problem. If my upstream is down, nginx return 503 Bad Gateway. I don't want to return any response, I want to close connection and/or return ERR_CONNECTION_REFUSED to client who tries to access my application through nginx when my real application is down. Is there a way to do something like that?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 91
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready