导航栏: 首页 评论列表

nginx rewrite xhr 405 静态文件

默认分类 2013-01-28 14:31:59

Nginx下使用rewrite规则 匹配指定规则 到 指定文件 , 然后用 Ajax 的 POST 方法去请求 JSON,则报 405 Method not allowed 错误。

解决方法: 重定向 405 错误码到 200

location ~ ^/(js/sandbox|uploads/rs|img)/ {
    root /data/runjs/webapp;
    error_page 405 =200 $uri;
}   

参考http://www.oschina.net/question/12_77690


>> 留言评论