Services whose service ID contains "//" cannot be deregistered
When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.
Overview of the Issue
When I register set serviceID to "http://www.emample.com/checkpath", when I need to undertake the registration, found that can't be registered
Reproduction Steps
- A domain name registration to the consul, ID = "http://www.emample.com/checkpath"
curl -X PUT 'http://localhost:8500/v1/agent/service/deregister/http://www.emample.com/checkpath'- I see that the service is not unregistered
Consul info for both Client and Server
Client info
agent:
check_monitors = 0
check_ttls = 0
checks = 3
services = 55
build:
prerelease =
revision = db839f18
version = 1.10.1
consul:
acl = disabled
bootstrap = false
known_datacenters = 1
leader = false
leader_addr = 192.168.9.2:10300
server = true
raft:
applied_index = 200434
commit_index = 200434
fsm_pending = 0
last_contact = 15.233699ms
last_log_index = 200434
last_log_term = 237
last_snapshot_index = 196640
last_snapshot_term = 234
latest_configuration = [{Suffrage:Voter ID:6f9c8e2c-f573-bd5e-c683-8ddd9a1afa54 Address:192.168.9.2:8300} {Suffrage:Voter ID:1065b07c-0ec3-0f42-82fb-a6d104f777a0 Address:192.168.9.2:9300} {Suffrage:Voter ID:1cfec106-a0ac-df7f-8845-5da40064e91c Address:192.168.9.2:10300}]
latest_configuration_index = 0
num_peers = 2
protocol_version = 3
protocol_version_max = 3
protocol_version_min = 0
snapshot_version_max = 1
snapshot_version_min = 0
state = Follower
term = 237
runtime:
arch = amd64
cpu_count = 8
goroutines = 117
max_procs = 8
os = linux
version = go1.16.6
serf_lan:
coordinate_resets = 0
encrypted = false
event_queue = 0
event_time = 34
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 69
members = 3
query_queue = 0
query_time = 1
serf_wan:
coordinate_resets = 0
encrypted = false
event_queue = 0
event_time = 1
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 15
members = 3
query_queue = 0
query_time = 1
Operating system and Environment details
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.04 Codename: focal
Log Fragments
None
What I'm doing now is, I'm re-registering. And configure the failure of the check. And configure a failed monitoring detection. configuration DeregisterCriticalServiceAfter="3s"
@dong9205 : does this work as expected if you URL-encode the service ID path parameter? (e.g., http://localhost:8500/v1/agent/service/deregister/%2Fhttp%3A%2F%2Fwww.emample.com%2Fcheckpath)
I have tried Urlencode for many times, and it cannot be unregistered.
@dong9205 : does this work as expected if you URL-encode the service ID path parameter? (e.g.,
http://localhost:8500/v1/agent/service/deregister/%2Fhttp%3A%2F%2Fwww.emample.com%2Fcheckpath)
I also have conducted Consul client for Deregister
consul services deregister ./consul-deregister-service.json
cat /consul-deregister-service.json
{
"Service": {
"Name": "http://www.emample.com/checkpath"
}
}
ERROR:Unexpected response code: 405 (method GET not allowed)
Consul client to deregister I have also tried to urlencode the URL, It does not take effect after the deregister is performed
I suspect that the // issue mentioned here is related to https://github.com/hashicorp/consul/issues/15933#issuecomment-1374189899