如何从另一个 Rest 服务调用 HTTPS Rest 服务?
How to invoke a HTTPS Rest service from another Rest service?
我有 Spring Cloud ConfigServer 使用自签名证书(通过 keytool 生成)启用了 SSL。配置服务器已启动并且 运行 在端口号 8888 使用 HTTPs 并且只能通过 HTTPS 访问,我已经通过浏览器对其进行了测试。
现在我的 Spring 启动应用程序之一(名为 myapp)正在尝试与此 ConfigServer 通信以获取它的 configurations.When 我的 Spring 启动应用程序启动,它获取尝试从 ConfigServer
获取配置时出现以下错误
ConfigServicePropertySourceLocator: Could not locate PropertySource: I/O error on GET request for "https://localhost:8888/myapp/default":java.security.cert.CertificateException: No name matching localhost found; nested exception is javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching localhost found
我应该在 Spring 启动应用程序中安装任何东西吗?像客户端 SSL 证书之类的东西吗?
这个link:
No matching localhost found
解释了整个故事。如果你打算在本地使用它(用于测试或开发的早期阶段),那么我建议使用第二个选项:
实现HostnameVerifier的verify()方法
它很干净,因为它在您的代码中,所以可以轻松地与您的同事共享,因此无需将安装手册附加到您的代码中。
我有 Spring Cloud ConfigServer 使用自签名证书(通过 keytool 生成)启用了 SSL。配置服务器已启动并且 运行 在端口号 8888 使用 HTTPs 并且只能通过 HTTPS 访问,我已经通过浏览器对其进行了测试。
现在我的 Spring 启动应用程序之一(名为 myapp)正在尝试与此 ConfigServer 通信以获取它的 configurations.When 我的 Spring 启动应用程序启动,它获取尝试从 ConfigServer
获取配置时出现以下错误ConfigServicePropertySourceLocator: Could not locate PropertySource: I/O error on GET request for "https://localhost:8888/myapp/default":java.security.cert.CertificateException: No name matching localhost found; nested exception is javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching localhost found
我应该在 Spring 启动应用程序中安装任何东西吗?像客户端 SSL 证书之类的东西吗?
这个link: No matching localhost found 解释了整个故事。如果你打算在本地使用它(用于测试或开发的早期阶段),那么我建议使用第二个选项:
实现HostnameVerifier的verify()方法
它很干净,因为它在您的代码中,所以可以轻松地与您的同事共享,因此无需将安装手册附加到您的代码中。