use a secondary upstream as backup
Sergey A. Osokin
osa at freebsd.org.ru
Wed Apr 23 13:26:06 UTC 2025
Hi Sébastien,
hope you're doing well.
Thanks for the question.
On Wed, Apr 23, 2025 at 12:07:21PM +0200, Sébastien Rebecchi via nginx wrote:
> backup, meaning NGINX will only use them if all primary servers fail.
>
> In my case, I have some servers running over HTTP and would like to
> configure HTTPS servers as backups. However, since an upstream can only use
> one protocol, this setup isn't currently possible.
[...]
The solution you may help and you may want to try to implement is "double"
proxy, where:
- at first, nginx is proxy to the loopback upstream, i.e. to itself
- on the second step nginx proxies from loopback to an original upstream
So, the original upstream block will look like this:
upstream insecure {
server A.B.C.D:80; # http server
server 127.0.0.1:8999;
<other directives here>
}
upstream secure {
server E.F.G.H:443; # https
<other directives here>
}
<other servers here>
server {
listen 127.0.0.1:8999;
location / {
proxy_pass https://secure;
<other directives here>
}
}
> Is there a feature like this planned, or one that could be considered for
> future development?
I don't think such feature is planned at the moment, just because all
servers defined in the same upstream should be configured equally.
Hope that helps.
Thank you.
--
Sergey A. Osokin
More information about the nginx
mailing list