簡體   English   中英

如何在Apache中為客戶端證書添加自定義錯誤?

[英]How do I add custom errors for client certificates in Apache?

當用戶未能提供客戶端證書或客戶端提供的證書無效時,如何配置自定義錯誤文檔?

當我遇到這些錯誤時,瀏覽器分別顯示ERR_BAD_SSL_CLIENT_AUTH_CERTERR_SSL_DECRYPT_ERROR_ALERT 我想為用戶提供一個自定義錯誤。

這就是我在NGINX中的方法

location = /495.html {}
error_page 495 /495.html;
location = /496.html {}
error_page 496 /496.html;

當我將以下行添加到apache配置中時,我收到錯誤消息“不支持的HTTP響應代碼495”

ErrorDocument 495 /495.html

這正在運行httpd-2.4.6-45.el7.centos.4.x86_64

更新:

通過將SSLVerifyClientrequire更改為optional並使用重寫規則,我能夠為496錯誤提供自定義錯誤文檔。

<Directory "/var/www/html">
  SSLVerifyClient optional
  RewriteEngine On
  RewriteCond %{SSL:SSL_CLIENT_VERIFY} !=SUCCESS
  RewriteRule . 496.html [L]
</Directory>

495錯誤仍然使我難以理解。

您正在運行什么版本的Apache?

https://unix.stackexchange.com/questions/290845/unsupported-http-response-code-429

Apache 2.2不支持495。

Apache 2.4確實根據https://httpd.apache.org/docs/2.4/custom-error.html對此提供支持

可以為指定為錯誤條件的任何HTTP狀態代碼(即任何4xx或5xx狀態)定義定制的錯誤響應。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM