function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Christian Peter 2Christian Peter 2 

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

Hello,

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.setEndpoint('callout:demo2');
req.setHeader('Content-Type', 'application/json');
req.setMethod('GET');

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

Name Credential URL:
public_docs.crg.es

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.