来自rails

时间:2016-07-15 20:47:47

标签: ruby-on-rails http nginx

我有一个IOS应用程序,我将带有几个字符串的图像传递给rails API。我已经开始从rails中获取此错误。我找不到任何导致此错误的信息。我假设它与传递大于平均数据包(图像)有关

{ status code: 500, headers {
    Connection = close;
    Date = "Fri, 15 Jul 2016 20:30:01 GMT";
    Server = "nginx/1.4.6 (Ubuntu)";
    "Transfer-Encoding" = Identity;
}

我是否应该尝试从客户端(IOS)或服务器(Rails / nginx)角度解决此问题?

潜在有用信息:

rails controller api以

开头
def image_build
    begin
      puts "Begin"

但“开始”从未打印过。

编辑1

更多信息:

在IOS中,这些行的输出如下:

print(response)
print(response.description)
print(response.data)
print(response.request)
print(response.response)

输出:

SUCCESS: 
SUCCESS: 
Optional(<>)
Optional(<NSMutableURLRequest: 0x7fa9539506a0> { URL: http://www.example.com/api/image_build })
Optional(<NSHTTPURLResponse: 0x7fa9515c9cd0> { URL: http://www.example.com/api/image_build } { status code: 500, headers {
    Connection = close;
    Date = "Fri, 15 Jul 2016 20:30:01 GMT";
    Server = "nginx/1.4.6 (Ubuntu)";
    "Transfer-Encoding" = Identity;
} })

编辑2

我认为从某种意义上说它只是超时。当我删除rails图像上传,只是让IOS发送图像仍然无法正常工作。但如果我告诉IOS不发送图像,字符串会成功传递。所以它只在IOS尝试发送图像时失败。

1 个答案:

答案 0 :(得分:0)

我不确定你会得到“puts”响应,理想情况下你应该使用rotateUplogger.debug等日志语句并检查日志。根据您所使用的Rails,如果在生产中,它将是开发环境中的log / production.log或log / development.log。它将为您提供有关您获得500错误的原因的更多答案。