# Ignore server name mismatch in Java transport client?

**URL:** <https://discuss.elastic.co/t/ignore-server-name-mismatch-in-java-transport-client/227950>\
**Category:** Elasticsearch\
**Created:** [April 14, 2020, 3:22pm UTC](https://discuss.elastic.co/t/ignore-server-name-mismatch-in-java-transport-client/227950 "2020-04-14T15:22:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimWardFS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timwardfs/32/65108_2.png) [@TimWardFS](https://discuss.elastic.co/u/TimWardFS)\
**Post date:** [April 14, 2020, 3:22pm UTC](https://discuss.elastic.co/t/ignore-server-name-mismatch-in-java-transport-client/227950/1 "2020-04-14T15:22:28Z")

</div>

For tedious reasons discussed elsewhere, I have a temporary need to talk to Elasticsearch using the Java transport client with the complications that

- communication has to be over TLS, I can't change that
- the server certificate will be presented with the wrong SAN, I can't change that

So the question is: how to tell the Java transport client to skip the SAN check and refrain from doing this:

```auto
      java.security.cert.CertificateException: No subject alternative DNS name matching elasticsearch-es-transport found.
      	at java.base/sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:207)

```

I have tried various things along the lines of `HttpsURLConnection.setDefaultHostnameVerifier()` but none of them has worked.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 12, 2020, 3:22pm UTC](https://discuss.elastic.co/t/ignore-server-name-mismatch-in-java-transport-client/227950/2 "2020-05-12T15:22:30Z")

</div>

Closed on May 12, 2020, 3:22pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
