2017-09-03 87 views
0

我們有一個配置,在該位置我們將服務器與EC2負載平衡器對齊。因此,看起來「主機」在到達服務器時沒有正確設置。正因爲如此,我們試圖使用代理設置值,但它似乎沒有工作。下面是配置:不能在負載均衡器後面的Amazon Linux上使用httpd設置HeaderRequest

NameVirtualHost *:80 

<VirtualHost *:80> 
ServerAdmin [email protected] 
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) 

是否還有其他需要在配置中包含的內容?您通常如何處理這種服務器由負載平衡器前置的情況?

+0

AWS ELB不會改變主機頭 –

回答

0

有一個在mod_proxy的用於調用特定的指令:

ProxyPreserveHost 

只要定義它並將其設置爲「ON」