2016-04-25 26 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 }