Coldfusion: CFHTTP with SSL-encrypted page (https: //) - got an error

I am doing cfhttp to connect to an encrypted page. It seems to work fine on some sites.

I/O Exception: Name in certificate `pro.test.com' does not match host name `go.test.com' 

Is there a way around this certificate, even if the host name does not match?

+2
source share
3 answers

Think this is more a Java issue, and a workaround should affect the JRE.

Not sure if this will work in your case, but a possible solution is to import this certificate into the JRE key store.

A general description can be found on the Sun website . Although the process is quite simple.

First you have to move the necessary HTTPS URL to your browser and export the certificate using SSL properties (don’t remember how to do it in IE, but in Firefox something like Security> View cert> Details> Save as - still not sure, because using non-lingual localization), any type of X.509 should work.

Then you should import it using keytool. Go to the current CF JRE bit, run the following command (replace the arguments with your values) and restart CF:

 keytool -keystore <path to keystore> -import -file <path to certificate> -alias <alias> 

By the way, there is a user interface tool for this, but I have not used it, so I can’t say if it works fine.

+8
source

Sites that are likely to work have a valid SSL certificate from a trusted authority.

If you have control over pro.test.com, the preferred answer is to get a valid certificate for installed pro.test.com. But if this is not possible for some reason, I see two other options:

1) Try / catch where you are trying to connect via https and go back to http in case of SSL error. Obviously, this will eliminate the encryption for the failed connection.

or

2) Use the Sergii solution to import the key for this site into the Java keystore.

0
source

If go.test.com is just a development server, then you can create a self-signed certificate and import it into the Java keystore. Thus, you can save on costs by not paying a CA and quickly solve the problem.

0
source

Source: https://habr.com/ru/post/1495473/


All Articles