公司代理后面的Micronaut服务器和httpclient [英] Micronaut server and httpclient behind corporate proxy

查看:214
本文介绍了公司代理后面的Micronaut服务器和httpclient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Win 7上运行micronaut微服务.

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

我的GET请求如下: http://localhost:8080/maps/myreq .

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

控制器使用httpclient将请求发送到外部网站: image.maps.api.here.com

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.

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

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

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

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

推荐答案

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

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

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

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".

请参见 https://docs.micronaut.io/1.1. 0/guide/index.html#proxy 了解更多信息.

我希望能帮上忙.

这篇关于公司代理后面的Micronaut服务器和httpclient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆