Closed egerix closed 3 months ago
I also ran into this. WireMock 3.2.0 is the most recent version that supports hosts that are only reachable via IPv6. In my case I am using WireMockRule
in JUnit tests, and like the reporter I am not trying to filter network addresses.
When using WireMock as a Java library, there is a workaround, but it is somewhat verbose (maybe there is a simpler way that I missed). You can implement your own com.github.tomakehurst.wiremock.http.client.HttpClientFactory
, copy/pasting most of com.github.tomakehurst.wiremock.http.HttpClientFactory
for your implementation, wrapping the result as in ApacheHttpClientFactory
, changing only these two lines as needed for your use case (e.g. just using SystemDefaultDnsResolver.INSTANCE
directly if you don't care about filtering addresses): https://github.com/wiremock/wiremock/blob/6b0b5cc3b71ad50eefb1c7d1cdd0865b2c3f0047/src/main/java/com/github/tomakehurst/wiremock/http/HttpClientFactory.java#L72-L73
The approach in https://github.com/wiremock/wiremock/pull/2737 would fix my case as well. If maintainers would prefer some kind of alternate approach, such as new configuration options to allowing IPv6-specific filtering or something like that, I would be happy to help implement it.
Proposal
Receiving an error when proxying to a host that is only accessible via IPv6: "Network failure trying to make a proxied request from WireMock to ..... failed: Network is unreachable (connect failed)".
I'm running WireMock in standalone mode without specifying either --allow-proxy-targets or --deny-proxy-targets. I set up mapping with proxying to a host, the DNS records of which contain both IPv4 and IPv6 addresses. However, due to network security settings, the IPv4 address is unreachable and only IPv6 is available, which is a common scenario.
The issue occurs following the changes in https://github.com/wiremock/wiremock/pull/2475, where WireMock forcibly filters out all IPv6 records.
Proposed solution: If no proxy rule (security rule) is set,
dns.resolve
should not be filtered and should return the records as they are.Reproduction steps
References
No response