hashicorp / consul

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
https://www.consul.io
Other
28.31k stars 4.42k forks source link

special characters in service id,can not deregister #20122

Open yuchunyun opened 9 months ago

yuchunyun commented 9 months ago

consul version: v1.14.5

Overview of the Issue

I accidentally registered a service with special characters in consul, now can not be deleted, an error is reported 400 Bad Request. How to resolved?

7182f850cd65f0f71e441df8c484f965

curl -X PUT -H 'X-Consul-Token: cd76a0f7-xxxx-xxxx-xxxx-073462acc6c7' 'http://192.168.120.57:8500/v1/agent/service/deregister/202.xxx.xxx.12:9062%E2%80%A8name=ymgjexporter' -v

...
400 Bad Request
...

Overview of the Issue


Reproduction Steps

Consul info for both Client and Server

Client info ``` Output from client 'consul info' command here ``` ``` Client agent HCL config ```
Server info ``` Output from server 'consul info' command here ``` ``` Server agent HCL config ```

Operating system and Environment details

Log Fragments

jkirschner-hashicorp commented 9 months ago

Try URL-encoding the service name in the deregister API call: https://developer.hashicorp.com/consul/api-docs/api-structure#url-encoded-resource-names

yuchunyun commented 9 months ago

As mentioned above, I have already URL-encoding the service name to 202.xxx.xxx.12:9062%E2%80%A8name=ymgjexporter, is that wrong?