【发布时间】:2018-05-13 10:36:25
【问题描述】:
我正在想办法在 AJP 的 ProxyPass 期间设置“主机”标头内容。
这是我使用 HTTP 的工作配置:
<VirtualHost *:80>
ProxyRequests off
ProxyPreserveHost off
ServerName my-external-domain
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/access.log combined
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel error
<Location />
ProxyPass http://my-internal-tomcat:8080/
ProxyPassReverse http://my-internal-tomcat:8080/
Order allow,deny
Allow from all
</Location>
</VirtualHost>
在 tomcat 上,检测到的服务器名称是 my-internal-tomcat(我想要的行为)。
这是我与 AJP 的第二次交流:
<VirtualHost *:80>
ProxyRequests off
ProxyPreserveHost off
ServerName my-external-domain
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/access.log combined
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel error
<Location />
ProxyPass ajp://my-internal-tomcat:8009/
ProxyPassReverse ajp://my-internal-tomcat:8009/
Order allow,deny
Allow from all
</Location>
</VirtualHost>
有了这个配置,在 servername 上检测到 不是 my-internal-tomcat
你知道为什么吗?
【问题讨论】:
标签: apache tomcat proxypass ajp