【发布时间】:2021-02-04 21:33:02
【问题描述】:
有没有办法从 HttpServletRequest 中判断请求是通过 Apache AJP 连接器还是直接发出的
<Connector port="8443"
scheme="https" secure="true" enableLookups="false" disableUploadTimeout="true"
maxHttpHeaderSize="8192" maxThreads="8000" acceptCount="3000" SSLEnabled="true"
maxConnections="10000" protocol="org.apache.coyote.http11.Http11NioProtocol">
...
</Connector>
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" secretRequired="false" />
我们的场景是一些用户通过互联网访问tomcat
webaddress:8443 --> 防火墙指向 Intranet apache:443 --> AJP 连接器到 tomcat:8009
在 Intranet 上时,客户管理员已将网址映射到 tomcat,以便
网址:8443 --> tomcat:8443
所以浏览器 URL 是相同的网址:8443 所以从 URL 无法判断它是通过 apache 还是直接到 tomcat
【问题讨论】: