简体   繁体   中英

How to invoke a HTTPS Rest service from another Rest service?

I have the Spring Cloud ConfigServer enabled SSL using a Self Signed certificate (generated via keytool). The config server is up and running at port number 8888 using HTTPs & accessible only via HTTPS , i have tested it via the browser.

Now one of my Spring Boot App (named myapp) is trying to communicate with this ConfigServer to fetch it's configurations.When my Spring Boot App starts-up , it gets the following error when trying to fetch the configurations from the 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

Should i be installing anything in my Spring Boot app ? anything like a client side SSL certificate ?

This link: No matching localhost found explains the whole story. If you are going to use it locally (for testing or early stage of development), then I would suggest going with the second option:

Implement the verify() method of HostnameVerifier
it is clean and since it is in your code it can be easily shared with your colleagues, so no need to attach installation manuals to your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM