简体   繁体   中英

Tomcat redirect on ERR_BAD_SSL_CLIENT_AUTH_CERT

I have done authentication via certificates on Java.

So, when certificate exists, everything works ok, when there is no certificate on client side, Chrome gives ERR_BAD_SSL_CLIENT_AUTH_CERT (Firefox gives another error. Doesn't matter)

I am trying to avoid showing this blank page to user.

So, is there any way to redirect(or show) to another page or html file when client has no certificate?

Many thanks

PS Sorry for my English. It is not my native language

As far as I know, there is no "easy" way that you can configure within Tomcat. However, it is possible to do, although too much effort in my opinion if you don't have a strict requirement. You would need to:

  • In Tomcat config, make the client auth no mandatory with "want" instead of "true". So Tomcat accepts clients with no valid certificate.
  • In your code, detect whether the client has provided a valid certificate and, if not, redirect the request to the page you like.

I have done this successfully under Apache Shiro because it was one of my requirements. But if it is only to display a "nice page" to the user, I don't think it is worth the work, and I would recommend not to spend time on this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM