+ Start a Discussion
Christian Peter 2Christian Peter 2 

"System.CalloutException: java.security.cert.CertificateException: Illegal given domain name" to subdomain with underscore


I'm using Name Credential to do callouts. Starting today, I'm getting an "invalid domain name" exception on domains which do contain an underscore.

For demo purposes I'm going to use a domain which a found while googleling for another domain contaning an underscore "public_docs.crg.es" to verify it has nothing to do with my employers network infrastructure.

Demo code:
HttpRequest req = new HttpRequest();      

req.setHeader('Content-Type', 'application/json');

Http http = new Http();
HTTPResponse res = http.send(req);
System.debug('res: '+ res);

Name Credential URL:

Any other domain not containing an underscore works like a charm.

Does anyone have a hint?

As a workaround, we are trying to migrate to non-underscore subdomains and avoid them in the future.
Steven LawranceSteven Lawrance
Thanks for asking about that. Fortunately, it should be possible to get it working by replacing the underscore characters with hyphens. As an example, public-docs.crg.es appears to resolve to the same target as public_docs.crg.es in DNS.