Google应用引擎拒绝https证书

时间:2017-03-23 14:33:48

标签: java google-app-engine https aws-api-gateway

我尝试从我的Google应用引擎实例连接到aws api网关服务。这是我得到的错误:

[INFO] Caused by: javax.net.ssl.SSLHandshakeException: Could not verify SSL certificate for URL: https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/v1?text=
[INFO]  at com.google.appengine.api.urlfetch.URLFetchServiceImpl.convertApplicationException(URLFetchServiceImpl.java:175)
[INFO]  at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:45)
[INFO]  at com.idiommaster.webpage.search.Search.get(Search.java:199)
[INFO]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

这是我的代码:

URLFetchService fetcher = URLFetchServiceFactory.getURLFetchService();
        FetchOptions lFetchOptions = FetchOptions.Builder.doNotValidateCertificate();
        HTTPRequest request = new HTTPRequest(new URL("https://XXXXXXXXXXXXXX.execute-api.us-east-1.amazonaws"), HTTPMethod.GET, lFetchOptions);
        HTTPResponse response = fetcher.fetch(request);

评论中要求的卷曲,我在这里发布是因为它太长而无法发表评论:

* Connected to xxxxxxx.execute-api.us-east-1.amazonaws.com (52.85.142.24x) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.execute-api.us-east-1.amazonaws.com
* Server certificate: Symantec Class 3 Secure Server CA - G4
* Server certificate: VeriSign Class 3 Public Primary Certification Authority - G5
> GET /v1?text=the+straw HTTP/1.1
> Host: xxx.execute-api.us-east-1.amazonaws.com
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 43433
< Connection: keep-alive
< Date: Thu, 23 Mar 2017 17:56:21 GMT
< x-amzn-RequestId: 050ab71b-0ff2-11e7-b034-217b9575c6f5
< x-custom-response-header: my custom response header value
< X-Amzn-Trace-Id: Root=1-58d40c43-eaaf8845a188b027ada01e01
< X-Cache: Miss from cloudfront
< Via: 1.1 52e0e6fa81aadeace92f9bb6da8543da.cloudfront.net (CloudFront)
< X-Amz-Cf-Id: aKaM_Lvpul1e1eHL7tAbKxY8Z9jwBc1O30xP0_garliKVFBlMR80MA==

无论如何,我暂时修复了这个问题,看起来它是在本地发生的,如果我部署它看起来很好。无论如何,不​​容易使用它

1 个答案:

答案 0 :(得分:0)

看起来这个问题只发生在本地开发实例上,一切都在远程实例上运行正常。