Search code examples
nginxhttp-status-codes

NGINX - How to return 500 instead 408 response code?


In NGINX is it possible to return, globally, a 500 response code instead returns 408? It's a strange request, I know. But from the client, that send requests to our Nginx, need to perform a retry if a request fails, and they are able only to intercept 5XX family errors at this time. Change the code is not possible in a quick time


Solution

  • You can set thus:

    error_page 408 = @error_target;
    location @error_target {
        return 500;
    }