选项http方法在Heroku上给出一个空响应 [英] OPTIONS http methods gives an empty response on Heroku
本文介绍了选项http方法在Heroku上给出一个空响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在本地执行操作时,我的CORS调用工作正常。
When I do things locally my CORS calls are working fine
$ curl -i -X OPTIONS "http://localhost:3000/api/v1/login"
HTTP/1.1 200 OK
X-Powered-By: Express
Access-Control-Allow-Origin: http://localhost:9000
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Headers: Content-Type
Content-Type: text/plain
Content-Length: 2
Set-Cookie: connect.sid=blablabla; Path=/; HttpOnly
Date: Wed, 02 Apr 2014 13:46:30 GMT
Connection: keep-alive
OK
但是当我在heroku上部署和尝试时,它不再工作:
But when I deploy and try the same on heroku it does not work anymore:
$ curl -i -X OPTIONS "http://<myapp>.herokuapp.com/api/v1/login"
curl: (52) Empty reply from server
任何想法可能是什么原因?
Any idea what that could be due to?
推荐答案
我提交了一张票,因为结果,事情不容易排除故障,但答案很简单:使用https而不是http
I filed a ticket for this, as it turned out, things were not easy to troubleshoot, but the answer is very simple: make your calls using https instead of http
这篇关于选项http方法在Heroku上给出一个空响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文