我有一个返回json响应的REST API.有时(而且似乎是完全随机的),json响应在中途被切断.因此,返回的json字符串如下所示:

...route_short_name":"135","route_long_name":"Secte // end of response

I'm pretty sure it's not an encoding issue because the cut off point keeps changing position, depending on the json string that's returned. I haven't found a particular response size either for which the cut off happens (I've seen 65kb not get cut off, whereas 40kbs would).

当切断发生时,查看响应标题:

{
    "Cache-Control" = "must-revalidate, private, max-age=0";
    Connection = "keep-alive";
    "Content-Type" = "application/json; charset=utf-8";
    Date = "Fri, 11 May 2012 19:58:36 GMT";
    Etag = "\"f36e55529c131f9c043b01e965e5f291\"";
    Server = "nginx/1.0.14";
    "Transfer-Encoding" = Identity;
    "X-Rack-Cache" = miss;
    "X-Runtime" = "0.739158";
    "X-UA-Compatible" = "IE=Edge,chrome=1";
}

Doesn't ring a bell either. Anyone?

推荐答案

I had the same problem:

Nginx切断了来自FastCGI后端的一些响应.例如,我无法从PhpMyAdmin生成正确的SQL备份.我判断了日志(log),发现了这个:

2012/10/15 02:28:14 [crit] 16443#0: *14534527 open() "/usr/local/nginx/fastcgi_temp/4/81/0000004814" failed (13: Permission denied) while reading upstream, client: *, server: , request: "POST / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "", referrer: "http://*/server_export.php?token=**"

我所要做的就是给/usr/local/nginx/fastcgi_tempclient_body_temp文件夹适当的权限来修复它.

Fixed!

非常感谢你的问题&;回答让我走上正轨.

Json相关问答推荐

SWIFT中的网络经理

如何将加权边列表导出到JSON树?

在ConvertFrom-Json之后需要从PowerShell对象中获取数据

Postgres Select json数组并重新映射属性名称

如何将一个对象添加到多个对象中 JOLT

将 GEOSwift.JSON 转换为 Swift 中的 struct

如何在生产环境中更改 Flutter 应用程序中的数据模型?

PowerShell - 如何迭代 PSCustomObject 嵌套对象?

如何在 Node.js 中解析包含NaN的 JSON 字符串

在 Http Header 中使用 Json 字符串

将 PHP 结果数组转换为 JSON

在 Postgres 中向 JSON 对象添加元素

如何在不消除对象歧义的情况下使用 circe 解码 ADT

在 Qt 4.7 中解析 JSON 的最简单方法

如何让 javascript 从 .json 文件中读取?

使用 Codable 序列化为 JSON 时的 Swift 字符串转义

如何在 Python 中合并两个 json 字符串?

SCRIPT5009:JSON未定义

case 类只有一个字段时如何将json转为 case 类

使用 PHP 将 CSV 转换为 JSON