clj-http

lassemaatta 2020-10-01T10:14:39.006900Z

Hi. Is it possible to specify the local address to bind to when using clj-http to send requests? I'm trying to build a local test environment for a suite of application(s), where I have services running on different loopback addresses (127.0.0.1, 127.0.0.2, ..) & ports. I'm trying to send requests using clj-http to a particular service, which filters incoming requests based on the source address. I'd like to tell clj-http to send from 127.0.0.2 but the source seems to always be 127.0.0.1. I've tried to create a custom RequestConfig, set its localAddress-field, and then used :http-builder-fns to manipulate the HttpClientBuilder to use this config. This seems to do something as I can do a request and from the result observe that the InternalHttpClient under the :http-client key refers to the correct local address. However, the request still originates from 127.0.0.1 (verified with wireshark). Any suggestions?

lassemaatta 2020-10-02T09:02:21.007Z

Sadly, I did not find an answer to this. I ended up migrating to http-kit , which provides an option for the local address.