场景:CentOS虚拟机 SpringCloud-Nacos Dubbo整合报错
failed to req API:/nacos/v1/ns/instance after all servers([192.168.56.101:8848, 192.168.56.102:8848, 192.168.56.103:8848]) tried: failed to req API:192.168.56.102:8848/nacos/v1/ns/instance. code:400 msg: <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'>Fri May 21 01:29:11 CST 2021</div><div>There was an unexpected error (type=Bad Request, status=400).</div><div>receive invalid redirect request from peer 192.168.56.101</div></body></html>
原因:
nacos服务启动的时候,使用的虚拟机的enp0s3网卡,ip为10.0.2.x
而192.168.56.x是enp0s8网卡的地址
所以这里的解决办法是在/nacos/conf/application.properties中打开配置项,指定下ip就可以了