Use HTTP Host header value as a destination address
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
Hello Team, I'm new to Consul and I'm trying to set up the environment in Kubernetes. My main reference is this tutorial https://www.consul.io/docs/k8s/connect.
I have Consul running and two pods with Envoy sidecar proxies. I curl Pod1 from Pod2 using the following command:
`curl --connect-to my_url:9080:1.2.3.4:9080 my_url:9080/productpage -H "Host: productpage.default"
`
**Expected result**: sidecar proxy resolves request Host header and redirects traffic to the corresponding host.
**Actual result**: it seems like the proxy ignores HTTP Host headers and uses the request's original destination. Which in my case is incorrect IP.
I was able to make the same example work with Istio. Is it possible to configure Consul the same way?
### Consul info for both Client and Server
Client info
```
agent:
check_monitors = 0
check_ttls = 2
checks = 6
services = 4
build:
prerelease = dev
revision = 876f3bb9
version = 1.12.0
version_metadata =
consul:
acl = disabled
known_servers = 1
server = false
runtime:
arch = amd64
cpu_count = 4
goroutines = 128
max_procs = 4
os = linux
version = go1.18.2
serf_lan:
coordinate_resets = 0
encrypted = false
event_queue = 0
event_time = 2
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 3
members = 2
query_queue = 0
query_time = 1
```
Server info
```
agent:
check_monitors = 0
check_ttls = 0
checks = 0
services = 0
build:
prerelease = dev
revision = 876f3bb9
version = 1.12.0
version_metadata =
consul:
acl = disabled
bootstrap = true
known_datacenters = 1
leader = true
leader_addr = 10.244.1.18:8300
server = true
raft:
applied_index = 2986
commit_index = 2986
fsm_pending = 0
last_contact = 0
last_log_index = 2986
last_log_term = 2
last_snapshot_index = 0
last_snapshot_term = 0
latest_configuration = [{Suffrage:Voter ID:ff3204f7-a6f4-fa80-62e3-612a42b903b6 Address:10.244.1.18:8300}]
latest_configuration_index = 0
num_peers = 0
protocol_version = 3
protocol_version_max = 3
protocol_version_min = 0
snapshot_version_max = 1
snapshot_version_min = 0
state = Leader
term = 2
runtime:
arch = amd64
cpu_count = 4
goroutines = 146
max_procs = 4
os = linux
version = go1.18.2
serf_lan:
coordinate_resets = 0
encrypted = false
event_queue = 0
event_time = 2
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 3
members = 2
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 = 1
members = 1
query_queue = 0
query_time = 1
```
Contributor guide
Research direction
Start with the Kubernetes Connect tutorial and reproduce the supplied curl command using the Host header. Then trace the Consul Connect and Envoy request-routing configuration involved; done means establishing whether Host-based destination routing is supported and documenting or implementing a verified route to productpage.default.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100