Refer to http://nginx.org/en/docs/http/ngx_http_ssl_module.html#errors
Defining an error page for code 400 will fail. Working approach
server { ... error_page 495 496 497 https:
Thus, the user was unable to send a valid certificate, will be redirected to google.com. This will work if ssl_verify_client set to on or optional .
Another approach only works when $ssl_verify_client set to optional , you can use $ssl_client_verify for redirection.
if ($ssl_client_verify = NONE) { return 303 https://www.google.com; }
If $ssl_verify_client set to on , it will not work.
source share