<div dir="ltr">Hello,<div><br></div><div>Hope you are doing well.</div><div>We currently use Authelia to authenticate users but want to add a redundant Authelia server so that users can continue to access the content.</div><div><br></div><div>Put simply our current nginx config is:</div><div><br></div><div>server {</div><div>  location / {</div><div>    auth_request /authelia;<br></div><div>    error_page 401 =302 <a href="https://authelia_cluster/?rd=$%7BDOLLAR%7Dtarget_url" target="_blank">https://authelia1.domain.net/?rd=$target_url</a>;<br></div><div>  }<br></div><div>  set upstream_authelia <a href="https://authealia1.domain.net/api/verify" target="_blank">https://authelia1.domain.net/api/verify</a>;</div><div>  location /authelia {</div><div>    internal;<br></div>    proxy_pass $upstream_authelia;<br><div>  }</div><div>}</div><div><br></div><div>Things I have tried:</div><div><br></div><div>With <a href="https://github.com/openresty/lua-resty-upstream-healthcheck">lua-resty-upstream-healthcheck</a> and the below upstream:<br></div><div><br></div><div>upstream authelia_cluster {<br>    least_conn;<br>    server <a href="http://authelia1.domain.net:443">authelia1.domain.net:443</a>;<br>    server authelia2.domain:443 backup;<br>    keepalive 60;<br>}<br></div><div><br></div><div>With this I am able to dynamically render content based on the available upstream authelia server but cannot translate that to authentication with `auth_request`.</div><div><br></div><div>location /test {</div><div>  proxy_pass <a href="https://authelia_cluster/metrics">https://authelia_cluster/metrics</a>;</div><div>}<br><br>My guess as to most simplest solution is to dynamically set the upstream_authelia variable and the error_page setting based on the available upstream authelia_cluster server but I am not sure how.</div><div><br></div><div>Any input is much appreciated!<br><br>Best,</div><div>Dave</div><div><br></div><div><br></div></div>