【问题标题】:Apache AJP, ProxyPass : How to set the Host headerApache AJP,ProxyPass:如何设置主机标头
【发布时间】: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


    【解决方案1】:

    我的回答可能有误,如果不对,请纠正我。

    AJP 根本无法做到这一点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-28
      • 1970-01-01
      • 2010-11-13
      • 2016-01-11
      • 1970-01-01
      • 1970-01-01
      • 2020-06-06
      相关资源
      最近更新 更多