Search code examples
http-proxymicronaut

Micronaut server and httpclient behind corporate proxy


I'm running a micronaut microservice on a Win 7.

My GET Request looks like : http://localhost:8080/maps/myreq.

The controller use a httpclient to send request to an external webseite : image.maps.api.here.com

When running without proxy, all went fine and the response is ok (an image).

But when running behind the proxy, connection timed out. Proxy works fine for any other applications or browser.

How to set micronaut server behind proxy to properly root requests?

edit : when sending a request, the netty server respond with an error : unable to connect to image.maps.api.here.com:xx.xx.xx.xx:xxxx where xx.xx.xx.xx:xxxx is the proxy


Solution

  • How to set micronaut server behind proxy to properly root requests?

    You can set the https.proxyHost, https.proxyPort, http.proxyUser and http.proxyPassword system properties. A common place to do that is in the MN_OPTS environment variable. For example, you could set MN_OPTS to have a value like "-Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3128 -Dhttp.proxyUser=test -Dhttp.proxyPassword=test".

    See https://docs.micronaut.io/1.1.0/guide/index.html#proxy for more info.

    I hope that helps.