我正在尝试为我的应用程序创建一个 API 代理,但我在 Heroku 上遇到了一些奇怪的超时错误。
说如下:
2012-12-10T12:49:24+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/api/v1/users/me host=host.herokuapp.com fwd=174.129.79.221 dyno=web.1 queue= wait= connect= service=30000ms status=503 bytes=0
代码如下所示:
$request = curl_init();
curl_setopt($request, CURLOPT_URL, $url);
curl_setopt($request, CURLOPT_USERAGENT, 'AppProxy/1.0');
curl_setopt($request, CURLOPT_HTTPHEADER, array(
'Accept: application/json',
'Authorization: Basic ' . $authorization,
'X-Requested-With: XMLHttpRequest'
));
curl_setopt($request, CURLOPT_VERBOSE, 1);
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($request);
echo curl_errno($request) . "<br />";
echo curl_error($request) . "<br />";
echo $httpStatus = curl_getinfo($request, CURLINFO_HTTP_CODE) . "<br />";
curl_close($request);
echo $response . "<br />";
有什么问题或者我在代码上遗漏了一些东西来让它工作?有人在 Heroku 上遇到过同样的问题吗?
提前致谢...