use a secondary upstream as backup
Sébastien Rebecchi
srebecchi at kameleoon.com
Wed Apr 23 10:07:21 UTC 2025
Hello,
I understand that within an upstream block, some servers can be marked as
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.
One solution I had in mind was to define a primary HTTP upstream and fall
back to a secondary HTTPS upstream if the first one fails, meaning all
servers in the primary upstream are unavailable. It could give something
like the example below. However, I couldn't find a way to implement this in
the NGINX documentation.
Is there a feature like this planned, or one that could be considered for
future development?
Thank you,
Sébastien
---
upstream main_upstream {
server <ip here>:80
server <ip here>:80
<etc>
}
upstream secondary_upstream {
server <ip here>:443
server <ip here>:443
<etc>
}
location / {
proxy_pass http://main_upstream *backup https://secondary_upstream
<https://secondary_upstream>*;
<etc>
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20250423/f7a976c7/attachment.htm>
More information about the nginx
mailing list