我已将 Apache2 配置为使用客户端证书身份验证:
SSLVerifyClient require
它有效,我可以使用有效的客户证书访问我的网站。但是,当用户在没有安装 ClientCertificate 的情况下连接到它时,他们会从浏览器中得到一个令人困惑的错误。
(Chrome 说“ERR_SSL_PROTOCOL_ERROR”,Firefox 说“ssl_error_handshake_failure_alert”,Internet Explorer 只说“Internet Explorer 无法显示网页”。
当用户尝试在没有有效客户端证书的情况下访问时,我想向用户显示自定义 ErrorDocument。
问题是该站点没有返回 http 错误代码,而是中止了请求,所以我不能使用 Apaches 的“ErrorDocument”。
ssl_error_log 的最后一部分是这样的:
[Wed Aug 31 11:11:57 2011] [info] [client 192.168.2.156] SSL library error 1 in handshake (server url:443)
[Wed Aug 31 11:11:57 2011] [info] SSL Library Error: 336105671 error:140890C7:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:peer did not return a certificate No CAs known to server for verification?
[Wed Aug 31 11:11:57 2011] [info] [client 192.168.2.156] Connection closed to child 1 with abortive shutdown (server url:443)
如何为此返回有效的 ErrorDocument?