Nginx and 400 SSL error handling

Marcello Lorenzi cello86 at
Tue Jun 11 08:25:32 UTC 2019

Hi All,

We’re trying to configure a client authentication on an Nginx 1.15.12 and
we noticed a “400 Bad Request - SSL Certificate Error” because a
certificate CA isn’t present into the certificates listed into
“ssl_client_certificate”. This is the configuration for the SSL

        ssl_verify_client optional;

        ssl_client_certificate /usr/local/nginx/ca-test.pem;

Actually we would return a 401 error page instead a 400 error page but we
aren’t able to customize the HTTP code but only the message reported with
this configuration.

        error_page 495 @error_ssl_495;

        location @error_ssl_495{

            return 401 'certificate invalid';


Is it possible to adjust also the http error code?

Thanks in advance,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list