2016-04-25 25 views
0

我有一個網站啓動並運行(我需要支持IE8)。IE8 - 內容不可接受Symfony 2應用程序

服務器:Nginx的,框架的Symfony2/PHP/MySQL的

問題很簡單:IE8(8.0.6)所示的是所有的HTML頁面的HTTP 不406Content接受

頭(Nginx的)

Cache-Control:no-cache 
Connection:keep-alive 
Content-Encoding:gzip 
Content-Type:text/html; charset=UTF-8 
Date:Mon, 25 Apr 2016 15:23:46 GMT 
Server:nginx/1.6.2 
Transfer-Encoding:chunked 
X-Debug-Token:d7e68f 

HTML(2個版本,不工作)

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" /> 
    <meta name="robots" content="noindex, nofollow"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>Htm 2</title> 
    <link rel="icon" type="image/x-icon" href="/favicon.ico" /> 
</head> 
<body> 
    ... hi 
</body> 
</html> 


<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <meta name="robots" content="noindex, nofollow"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>Htm</title> 
    <link rel="icon" type="image/x-icon" href="/favicon.ico" /> 
</head> 
<body> 
    ... hi 
</body> 
</html> 

我已閱讀噸的關於該事項的東西,但沒有找到任何線索。以前的網站版本在IE8上運行,並在Apache 2上運行。

回答

0

此錯誤與Nginx無關,但與Symfony 2FOSRESTBundle依賴於客戶端頭文件通過格式偵聽器關聯響應內容。

解決方案:

我改變了我的配置,禁用FOSRest禁用格式監聽器的HTML頁面。

fos_rest: 
    format_listener: 
     rules: 
      - { path: '^/rest', priorities: [ 'json' ], fallback_format: json, prefer_extension: false } 
      #- { path: ^/, priorities: [ 'text/html', '*/*' ], fallback_format: html, prefer_extension: true } 
      - { path: '^/', stop: true }