Postman / Curl无法使用Google App引擎部署的应用

时间:2017-05-27 22:46:42

标签: google-app-engine curl postman google-app-engine-python

我已经在Google App Engine(标准版)上部署了一个Django应用程序,如果我通过浏览器(任何)访问它,它可以正常工作。但是,我无法在终端上使用curl或使用Postman应用程序运行任何测试。当我尝试运行curl时,它会超时:

curl --verbose -X GET "https://SERVER.appspot.com"
Note: Unnecessary use of -X or --request, GET is already inferred.
* Rebuilt URL to: https://SERVER.appspot.com/
*   Trying x.x.x.x...
* TCP_NODELAY set
* Connected to SERVER.appspot.com (x.x.x.x) port 443 (#0)
* Operation timed out after 300225 milliseconds with 0 out of 0 bytes received
* Curl_http_done: called premature == 1
* Closing connection 0
curl: (28) Operation timed out after 300225 milliseconds with 0 out of 0 bytes received

知道我做错了什么吗?同一个应用程序在本地运行良好,我可以运行Postman / curl。如果我使用http://代替https://尝试相同(即卷曲或邮差),它可以正常工作(但https://在使用浏览器时仍然有效。)

我需要做些什么才能让它从终端开始工作?

1 个答案:

答案 0 :(得分:1)

原来是SSL'信任'问题。需要为映射到App Engine实例的每个子域添加SSL支持。事实证明,如果您没有正确完成此操作(在我的情况下,.crt软件包中缺少一个CA中间证书),您的浏览器可能会认为该网站是安全的,但curl / postman将失败 - 或者更确切地说是超时没有告诉你太多。我能够在我的子域上运行一些测试:https://www.ssllabs.com/ssltest

它指出所提供的CA证书是不完整的,并将其评为B.修复此问题立即修复了卷曲和邮递员问题(我假设邮递员内部正在使用卷曲?我离题了。)