Nginx local fallback error page if proxy destination is unavailable

Solution 1:

Actually, I only had to slightly modify your config:

error_page 501 502 503 /500.html;
location = /500.html {
        root   /locust/www/fallback/htdocs;
}

and obviously rename the index.html you want to present to 500.html.

Solution 2:

Try to specify exact url for the error page like:

    proxy_intercept_errors on;
    error_page  500 502 503 504 402 403 401  /500.html;
    root   /locust/www/fallback/htdocs;