×

nginx 服务器

NGINX服务器,通过proxy导致 IE 9不能正确显示CSS

天外来信 天外来信 发表于2013-03-16 14:46:09 浏览4615 评论1

1人参与发表评论

 

原因,IE9对文件的  content type很严格,如果用 txt/plain 就不会当css来解析

 

其它浏览器会自动转换。

 

由于我的网站使用 统一的css.php加载                                                                                                                                                                                                                                                                                                                      所以解决方案如下:

 

        location ~ css\.php$ {

  proxy_pass http://$server_addr:81;

  proxy_redirect off;

  proxy_set_header Host $host;

  proxy_set_header X-Real-IP $remote_addr;

  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

  proxy_set_header Content-Type "text/css; charset: utf-8";

  #proxy_hide_header Content-Type;

}

评论列表

访客
mo&co. mo&co.2013-04-10 05:26:51 | 回复 mo&co.到此围观,您的文章写的真是太惊天地,泣鬼神了,佩服万分,发此评论以感涕零,三拜!!