Micronaut服务器和httpclient背后的企业代理

问题描述 投票:0回答:2

我在Win 7上运行微型微服务。

我的GET请求看起来像:http://localhost:8080/maps/myreq

控制器使用httpclient向外部webseite发送请求:image.maps.api.here.com

当没有代理运行时,一切正常,响应正常(图像)。

但是当在代理后面运行时,连接超时。代理适用于任何其他应用程序或浏览器。

如何在代理后面设置微服务器以正确根请求?

编辑:发送请求时,netty服务器响应错误:无法连接到image.maps.api.here.com:xx.xx.xx.xx:xxxx其中xx.xx.xx.xx:xxxx是代理

http-proxy micronaut
2个回答
0
投票

如何在代理后面设置微服务器以正确根请求?

您可以设置https.proxyHosthttps.proxyPorthttp.proxyUserhttp.proxyPassword系统属性。常见的地方是MN_OPTS环境变量。例如,您可以将MN_OPTS设置为具有"-Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3128 -Dhttp.proxyUser=test -Dhttp.proxyPassword=test"之类的值。

有关更多信息,请参阅https://docs.micronaut.io/1.1.0/guide/index.html#proxy

我希望有所帮助。


0
投票

我通过设置CLI的代理来解决问题,但也通过在application.yml中设置代理来完成这里:https://github.com/micronaut-projects/micronaut-core/issues/1611

© www.soinside.com 2019 - 2024. All rights reserved.