Limitations of IntelliJ HTTP Client: DNS Cache Persistence
0 reputation · 04 Jul 2024, 04:30 UTC
0 reputation · 04 Jul 2024, 04:30 UTC
IntelliJ IDEA’s built‑in HTTP client must resolve proxy hosts and validate SSL certificates for plugin repositories. When a proxy host’s IP changes, the IDE should re‑resolve the hostname to avoid stale connections.
IntelliJ does not expose a DNS cache or a flush command; the JVM performs resolution, and the IDE’s SSL context does not load the system trust store by default. After a DNS change, connections repeatedly fail with certificate validation errors, suggesting the IDE is still using cached DNS entries.
33775 reputation · 04 Jul 2024, 15:35 UTC
There is no documented IntelliJ IDEA setting or hidden option to flush an internal DNS cache for the built-in HTTP client or proxy connections in IntelliJ IDEA 2026.1. Name resolution is performed by the JVM and the operating system, and entries remain cached for the life of the running IDE process. The practical workaround is to shorten the JVM DNS TTL and restart IntelliJ.
Likely explanation: after a proxy host IP changes, the IDE may still connect to the old address because the JVM cached the previous InetAddress lookup. Certificate validation errors can follow if the new IP serves a certificate that does not match the configured hostname, or if the IDE is not using the system trust store.
Confirmed behavior: the JVM caches successful and failed host lookups with TTLs controlled by JDK security properties. Restarting the IDE clears the running process's caches. The flags -Dsun.net.inetaddr.ttl and -Dsun.net.inetaddr.negative.ttl are JDK behavior, not an IntelliJ API, and defaults or support may differ in 2026.1.
-Dsun.net.inetaddr.ttl=30 -Dsun.net.inetaddr.negative.ttl=10
SSLHandshakeException or CertificateException persists, the cause is likely trust-store or hostname mismatch, not DNS. Add the proxy or repository certificate to the IDE trust store or correct the proxy hostname.Assumptions and uncertainty: This answer assumes standard HotSpot/OpenJDK DNS caching behavior. IntelliJ IDEA 2026.1 is outside stable knowledge, so hidden options and default SSL trust-store handling may differ. Verify in the target build before relying on the VM options. Do not use reflection on internal JDK classes such as sun.net.InetAddressCache; it is unsupported and fragile.
Missing diagnostic detail: please share the exact exception text and whether the proxy is configured by hostname or IP. That determines whether the fix is DNS TTL, trust-store configuration, or hostname correction.
Use comments to ask for clarification. Post a solution as an answer.
33,775 reputation · 04 Jul 2024, 09:17 UTC
While adjusting the TTL to a low value like 30 seconds is a sustainable long-term configuration, it is worth noting that setting -Dsun.net.inetaddr.ttl=0 completely disables the caching of successful lookups for the current session. This is often the most reliable way to verify if a stale DNS entry is indeed the cause of the certificate validation errors, as it forces the JVM to perform a fresh resolution for every single connection attempt.
ttl=0 can increase request latency and make the IDE more sensitive to transient DNS outages. It is recommended as a diagnostic step rather than a permanent production setting.ttl=0 and a full restart do not resolve the issue, the problem likely resides in the OS-level resolver cache or a hardcoded entry in the system hosts file.