我正在嘗試使用apache mod_include。我試圖在我的test_local.shtml(server1)中包含一些來自test_remote.shml(server2)的簡單文本。使用mod_include和mod_proxy包含遠程.shtml文件時出現亂碼文本
test_local.shtml:
<html>
<head>
<title></title>
</head>
<body>
<!--#include virtual="http://www.server2.com/test_remote.shtml"-->
</body>
</html>
test_remote.shtml:
<b>this is a test</b>
起初,它沒有工作(有 「文件不存在」 錯誤error_log中)。 看起來出於安全原因,我管理的唯一文件位於本地服務器(server1)上,具有本地路徑,但不是遠程URL。 然後我明白我需要將mod_proxy(和mod_proxy_html)與mod_include結合使用,以實現遠程包含工作。
所以我增加了以下我的httpd.conf(Server1上):
ProxyPass /server2 http://www.server2.com
然後,我改變了包括test_local.shtml到行:
<!--#include virtual="/server2/test_remote.shtml"-->
沒有錯誤這一次,東西得到包括,但由此產生的文字全是亂碼:
‹³I²+ÉÈ,V¢D…’Ôâý$;.j¿è
我在配置中丟失了什麼?怎麼了?
更新:我懷疑這是兩個服務器之間發送(然後讀取)數據的方式,如壓縮或類似的。我檢查了mod_deflate配置部分,它包含在兩個服務器中,並且都是一樣的。任何想法?謝謝
UPDATE 2:禁用server2上的SetOutputFilter DEFLATE,server1上的mod_include包含的文本是完全可讀的。所以這就是問題的根源:我如何配置server1來處理gzip內容並正確顯示它? (Hypotetically我想像某種inputfilter反對outputfilter ..)