nacos icon indicating copy to clipboard operation
nacos copied to clipboard

nacos client bad request 400

Open JavaAjust opened this issue 3 years ago • 8 comments

Describe the bug A clear and concise description of what the bug is. maven install 导出项目的jar包,本地开发运行,在部分机器上正常运行,在部分机器上启动报错 bad request

Maven install exports the jar package of the project, develops and runs locally, runs normally on some machines, and starts bad request on some machines

Desktop (please complete the following information):

  • OS: windows10
  • Version [nacos-server 2.0.1, nacos-client 1.4.2]
  • Module [naming and config]
  • SDK [jdk1.8, spring-cloud-alibaba-nacos, spring cloud]

Additional context Add any other context about the problem here. the exception : Caused by: com.alibaba.nacos.api.exception.NacosException: failed to req API:/nacos/v1/ns/instance after all servers([http://nacos-test.xxxxx.cn:80]) tried: ErrCode:400, ErrMsg:<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Mon Aug 30 17:41:11 CST 2021</div><div>There was an unexpected error (type=Bad Request, status=400).</div><div>receive invalid redirect request from peer 10.233.71.38</div></body></html>

JavaAjust avatar Aug 31 '21 02:08 JavaAjust

你的集群搭建的有问题,导致请求路由异常了。

KomachiSion avatar Sep 03 '21 01:09 KomachiSion

你看一下发送的请求头,我之前遇到过类似的问题,因为经过两个网关,X-forwarded-host的值重复了,就报了400错误。

wanglin0413 avatar Sep 03 '21 08:09 wanglin0413

你的集群搭建的有问题,导致请求路由异常了。

具体哪些问题导致的?线上的集群基本没出现过,测试环境经常这样。 是集群之间连接访问的问题吗 @KomachiSion

JavaAjust avatar Sep 08 '21 07:09 JavaAjust

你看一下发送的请求头,我之前遇到过类似的问题,因为经过两个网关,X-forwarded-host的值重复了,就报了400错误。

哪个请求头,客户端的请求头吗,直接用postman请求的,我修改了客户端的ip是没问题的,有些客户端ip不行。网关X-forwarded-host重复,是指网关配置问题?具体怎样解决的

JavaAjust avatar Sep 08 '21 07:09 JavaAjust

看一下集群的cluster.conf 是不是有多出来的ip之类的, 很可能是集群搭建的时候配置不正确,或者存在多网卡,域名等情况,导致节点自身地址和配置地址不一致导致的。

KomachiSion avatar Sep 10 '21 01:09 KomachiSion

同时如果有网络代理或网关转发等,都有可能导致服务端判断请求来源时出错,建议配置代理或转发时不进行任何修改。

KomachiSion avatar Sep 10 '21 01:09 KomachiSion

我的也是这个问题 把nginx去掉也不行 cluster.config就三个ip,后台管理里显示三个节点也没问题,但还是老400

jiangtianyou avatar Nov 17 '21 16:11 jiangtianyou

Thanks for your feedback and contribution. But the issue/pull request has not had recent activity more than 180 days. This issue/pull request will be closed if no further activity occurs 7 days later. We may solve this issue in new version. So can you upgrade to newest version and retry? If there are still issues or want to contribute again. Please create new issue or pull request again.

stale[bot] avatar Sep 21 '22 00:09 stale[bot]