Docker Nacos deployment uses container name to access 400 bad request

Springboot error

Ignore the empty nacos configuration and get it based on dataId

Curl test error

< HTTP/1.1 400 
< Content-Type: text/html;charset=utf-8
< Content-Language: en
< Content-Length: 435
< Date: Fri, 03 Sep 2021 03:06:16 GMT
< Connection: close
* Closing connection 0
<!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1></body></html>

Original request address

http://private_ appstore_ cloud_ nacos:8848

Modify container name and new request address


Through curl test, it is found that the original request address server responds to 400 and the new address responds to 200. The reason is that the Nacos server determines that the HTTP protocol header host contains non-standard domain name characters.

Read More: