我有一个在开发中运行良好的九头蛇请求。但生产失败了。响应看起来像这样
options:
:return_code: :ok
:response_headers: ! "HTTP/1.1 200 OK\r\nContent-Type: application/json; charset=utf-8\r\nTransfer-Encoding:
chunked\r\nConnection: keep-alive\r\nStatus: 200\r\nX-Powered-By: Phusion Passenger
(mod_rails/mod_rack) 3.0.19\r\nX-UA-Compatible: IE=Edge,chrome=1\r\nETag: \"2ef0bc08f9b4fa4c7ecc4092f387c4c7\"\r\nCache-Control:
max-age=0, private, must-revalidate\r\nX-Request-Id: df304fd28b406f8b3a97c84a7ce4de5e\r\nX-Runtime:
0.614748\r\nDate: Sat, 27 Jul 2013 08:03:09 GMT\r\nX-Rack-Cache: invalidate, pass\r\nServer:
nginx/1.2.6 + Phusion Passenger 3.0.19\r\n\r\n"
:response_body: ! '{"status":"success","message":"Message Sent","code":"200"}'
:httpauth_avail: 0
:total_time: 5.700828
:starttransfer_time: 5.700666
:appconnect_time: 4.387121
:pretransfer_time: 4.387193
:connect_time: 0.446846
:namelookup_time: 0.001348
:effective_url: !binary |-
aHR0cHM6Ly9maXJlZmx5YXBpLmNvbS9hcGkvc21z
:primary_ip: !binary |-
MTczLjI0Ni40MC4yNA==
:response_code: 200
但在生产中它会返回ssl_cacert
代码:
options:
:return_code: :ssl_cacert
:response_headers: ''
:response_body: ''
:httpauth_avail: 0
:total_time: 0.419993
:starttransfer_time: 0.0
:appconnect_time: 0.0
:pretransfer_time: 0.0
:connect_time: 0.321081
:namelookup_time: 0.245361
:effective_url: !binary |-
aHR0cHM6Ly9maXJlZmx5YXBpLmNvbS9hcGkvc21z
:primary_ip: !binary |-
MTczLjI0Ni40MC4yNA==
:response_code: 0
知道为什么会这样吗?
答案 0 :(得分:1)
通过在typhoeus请求中添加以下内容来解决此问题:
ssl_verifypeer: false
谢谢你们!
答案 1 :(得分:1)
我遇到了同样的问题
虽然ssl_verifypeer: false
工作正常,
我在我的机器(Ubuntu)上安装了libcurl4-openssl-dev
,现在它验证证书就好了,而不使用将verifypeer设置为false