我们的案例是将网站从 Apache 2.2 迁移到 2.4,并遵循此文档的许多提示:https://httpd.apache.org/docs/2.4/upgrading.html
但是当取消证书对话框时,将用户重定向到我们的 403 页面 ErrorDocument 仍然无法正常工作。
在 Apache 2.2 中这可以工作,但是在 Apache 2.4 中规则无法正确退出并处于禁止状态:
RewriteEngine On
RewriteCond %{SSL:SSL_CLIENT_VERIFY} !FAILED:(null)
RewriteRule .* - [F]
在我的虚拟主机 conf 文件中有此错误文档页面(注意:替换了 IP 和 fqdn 名称):
ErrorDocument 404 https://MYSITE.REPLA.CED/error_404.html
ErrorDocument 403 https://MYSITE.REPLA.CED/error_403.html
ErrorDocument 500 https://MYSITE.REPLA.CED/tempOutOfOrder.html
ErrorDocument 501 https://MYSITE.REPLA.CED/tempOutOfOrder.html
ErrorDocument 503 https://MYSITE.REPLA.CED/tempOutOfOrder.html
当我尝试出示我的证书时,一切正常,但是当在浏览器缓存中没有我的证书的新干净会话中(即隐身模式)时,当出现证书对话框以进入网站并按取消时,此异常不受禁止重写指令的管理。
按“取消”时的跟踪如下(注意:替换了 IP 和 fqdn 以及敏感上下文):
80.190.80.190 - - [07/Nov/2020:19:25:06 +0100] "POST /mydircert HTTP/1.1" 200 5025 "https://MYSITE.REPLA.CED/CONTEXT1/CONTEXT2/CONTEXT3?response_type=code&client_id=tram.client_referer.cat&redirect_uri=http://10.20.10.20:8080/client-myapp/api/auth&scope=autenticacio_usuari&state=test&access_type=online&approval_prompt=auto" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
80.190.80.190 - - [07/Nov/2020:19:25:07 +0100] "GET /mydircss/main.css HTTP/1.1" 200 8582 "https://MYSITE.REPLA.CED/CONTEXT1/CONTEXT2/CONTEXT3" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
80.190.80.190 - - [07/Nov/2020:19:25:07 +0100] "GET /mydircss/A10C9096DE9D1EFEC28D010376BD7434/logo.gif HTTP/1.1" 200 3261 "https://MYSITE.REPLA.CED/CONTEXT1/CONTEXT2/CONTEXT3" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
80.190.80.190 - - [07/Nov/2020:19:25:07 +0100] "GET /mydircss/img/logo_mycompany.png HTTP/1.1" 200 2234 "https://MYSITE.REPLA.CED/CONTEXT1/CONTEXT2/CONTEXT3" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
80.190.80.190 - - [07/Nov/2020:19:25:07 +0100] "GET /mydircss/img/alert.png HTTP/1.1" 200 1438 "https://MYSITE.REPLA.CED/CONTEXT1/CONTEXT2/CONTEXT3" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
80.190.80.190 - - [07/Nov/2020:19:25:07 +0100] "GET /mydircss/bootstrapMB.css HTTP/1.1" 200 9106 "https://MYSITE.REPLA.CED/CONTEXT1/CONTEXT2/CONTEXT3" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
80.190.80.190 - - [07/Nov/2020:19:25:07 +0100] "GET /mydircss/A10C9096DE9D1EFEC28D010376BD7434/myvalidatorIden.css HTTP/1.1" 200 11236 "https://MYSITE.REPLA.CED/CONTEXT1/CONTEXT2/CONTEXT3" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
80.190.80.190 - - [07/Nov/2020:19:25:07 +0100] "GET /mydircss/img/barra.png HTTP/1.1" 200 928 "https://MYSITE.REPLA.CED/CONTEXT1/CONTEXT2/CONTEXTCSS/A10C9096DE9D1EFEC28D010376BD7434/myvalidatorIden.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
很高兴看到所有痕迹都在访问日志中,任何痕迹都在错误日志中,我猜想禁止事件可能写入了错误日志?
嗯,情况是这样的,当按下证书对话框中的“取消”按钮时,Apache 2.4 中的错误处理出现问题,而 Apache 2.2 中的相同代码却可以正常工作。
提前谢谢了!