2014-01-29 29 views
0

我已將Apache2配置爲充當IIS中運行的網站的反向代理,以卸載站點的SSL和ModSecurity。對於大多數瀏覽器來說,它似乎工作得很好,直到我嘗試從iPad訪問網站時,顯然它正在重寫頁面,導致頁面加載不正確。apache2反向代理無意中更改內容

如果我更改用戶代理以匹配iPad的用戶代理,我可以在另一個瀏覽器中重新創建問題。

頁的源代碼的前幾行應該是這樣的:

<!DOCTYPE html> 
<html lang="en"> 
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" /><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /><meta name="format-detection" content="telephone=no" /><title> 

     Login - Intuition by Vertex 
</title> 
    <link href="/VertexIntuition/Content/images/favicon.png" rel="icon" type="image/png" /> 

    <script src="/VertexIntuition/bundles/jquery?v=UgyEMAYOuSB9Bb6HcOEVHpd6fIIp54yF086SRNVcdIY1"></script> 
<script src="/VertexIntuition/bundles/tablet?v=2kDCvhCBNKBgX0qN9fTU9DAHVqMl3xRFihmIqyYo6hY1"></script> 
<link href="/VertexIntuition/Content/style/tabletbundle?v=ItHS3VZO8NwiILS32jviRjVSaLWeZuF0S17HnIT_2Y01" rel="stylesheet"/> 


    <!-- Framework CSS --> 
    <!--[if lt IE 8]> 

    <link rel="stylesheet" href="/VertexIntuition/Content/style/tablet/blueprint/ie.css" type="text/css" media="screen, projection" /> 
    <![endif]--> 

    <!-- Page specific styles --> 

    </head> 
<body> 

通過反向代理訪問的頁面時,將源的同一塊被改寫爲:

<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><meta name="format-detection" content="telephone=no"><title> 

     Login - Intuition by Vertex 
</title><link href="/VertexIntuition/Content/images/favicon.png" rel="icon" type="image/png"><script src="/VertexIntuition/bundles/jquery?v=UgyEMAYOuSB9Bb6HcOEVHpd6fIIp54yF086SRNVcdIY1"></script><script src="/VertexIntuition/bundles/tablet?v=2kDCvhCBNKBgX0qN9fTU9DAHVqMl3xRFihmIqyYo6hY1"></script><link href="/VertexIntuition/Content/style/tabletbundle?v=ItHS3VZO8NwiILS32jviRjVSaLWeZuF0S17HnIT_2Y01" rel="stylesheet"><!-- Framework CSS --><!--[if lt IE 8]> 

    <link rel="stylesheet" href="/VertexIntuition/Content/style/tablet/blueprint/ie.css" type="text/css" media="screen, projection" /> 
    <![endif]--><!-- Page specific styles --></head><body> 

並且頁面的佈局最終會被錯誤地格式化(不僅僅是這些被改變的文本塊,我只是用它作爲改變的一個例子。)

該網站配置如下:

<VirtualHost *:443> 
    ServerAdmin [email protected] 
    ErrorLog /var/log/apache2/reverseproxy-ssl_error.log 
    LogLevel info 
    CustomLog /var/log/apache2/access-ssl.log combined 

    ProxyRequests off 

    <Proxy *> 
    Order deny,allow 
    Allow from all 
    </Proxy> 

    ProxyPreserveHost On 
    ProxyHTMLInterp on 

    ProxyPass/http://internal.site.local/ 
    ProxyPassReverse/http://internal.site.local/ 

    SetOutputFilter proxy-html 
    ProxyHTMLURLMap http://internal.site.local/

    RequestHeader unset Accept-Encoding 

    SSLEngine on 
    SSLProxyEngine On 

    SSLCertificateFile /etc/ssl/certs/server.crt 
    SSLCertificateKeyFile /etc/ssl/private/server.key 
    SSLCertificateChainFile /etc/ssl/certs/intermediate.crt 
</VirtualHost> 

我已經完全殘疾了ModSecurity現在爲了解決這個問題,這個問題仍然存在,所以它不應該是。

我使用的URL看起來是這樣的: https://mysite.example.com/VertexIntuition/SystemUser/Login ,並再次,它似乎運行作爲反向大多數其他瀏覽器

,如果我從服務器運行

wget --user-agent="Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B405 Safari/531.21.10" http://internal.site.local/VertexIntuition/SystemUser/Login" 

工作代理,我得到的頁面顯示正確。

回答

1

顯然實際上並沒有問題,只是一些奇怪的緩存問題和ModSecurity規則之一的組合。我的配置很好。

規則集被觸發,導致問題是modsecurity_crs_21_protocol_anomalies.conf 這導致頁面的不正確呈現。關閉ModSecurity後,問題仍然存在,因爲我的瀏覽器未正確清除緩存。