繁体   English   中英

无法在负载均衡器后面的Amazon Linux上使用httpd设置HeaderRequest

[英]Not Able to Set HeaderRequest with httpd on Amazon Linux behind Load Balancer

我们有一个配置,使我们可以使用EC2负载均衡器在服务器前端。 因此,似乎“主机”在到达服务器时未正确设置。 因此,我们正在尝试使用代理设置值,但是它似乎不起作用。 下面是配置:

NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin admin@test.com
DocumentRoot "/mnt/dataebs/apache/test"
ServerName www.test.com
ServerAlias www.test.com
ErrorLog "/mnt/dataebs/apache/test-error.log"
CustomLog "/mnt/dataebs/apache/test-access.log" common

<Directory "/mnt/dataebs/apache/test">
    Options Indexes FollowSymLinks Includes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

RequestHeader set Host "www.test.com"
RequestHeader set Accept-Encoding "gzip, deflate"
ProxyPass /fabric http://<ip_address>/fabric
ProxyPassReverse /fabric http://<ip_address>/fabric

ProxyPassReverseCookiePath / /

</VirtualHost>

我一直在寻找潜在的解决方案,但是到目前为止,我还没有找到真正能够解决问题的解决方案。 我还仔细检查过以确保启用了mod_headers:

$ httpd -t -D DUMP_MODULES | grep header
Syntax OK
headers_module (shared)

我们还需要在配置中包含其他内容吗? 通常情况下,服务器负载平衡器如何处理这种情况?

在mod_proxy中有一个特定的指令称为:

ProxyPreserveHost

只需定义它并将其设置为“ on”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM