gateway Internal Server Error 500 Invalid host: lb://xxxxxx

The following error occurred while accessing other project interfaces through the gateway

2021-11-01 17:01:28.244 ERROR 4732 --- [ctor-http-nio-2] a.w.r.e.AbstractErrorWebExceptionHandler : [5761064e-3]  500 Server Error for HTTP GET "/admin/user/list"

java.lang.IllegalStateException: Invalid host: lb://zkdn_admin
	at ~[spring-cloud-gateway-server-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
	|_ checkpoint ⇢ [DefaultWebFilterChain]
	|_ checkpoint ⇢ HTTP GET "/admin/user/list" [ExceptionHandlingWebHandler]
Stack trace:
		at ~[spring-cloud-gateway-server-2.2.6.RELEASE.jar:2.2.6.RELEASE]

The reason is that the service name registered in Nacos has “”, which can be solved by changing the underscore to “-“.

Read More: