twitter/finagle

How to set Host header with LoadBalancing

Open

#562 geöffnet am 18. Okt. 2016

Auf GitHub ansehen
 (15 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Scala (1.435 Forks)batch import
good first issue

Repository-Metriken

Stars
 (8.864 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

According to #560 you may be discussing but I got confused when using Finagle's load balancing feature. In order to distribute requests to multiple servers, we instantiate a service via Http.Client#newService as follows,

val client = Http.client.newService("hostA.org:80, hostB.org:80")

Then construct request,

val request = Request("/path/to/service")
request.host = ???

client(request)

What should we fill ??? with?

Moreover, we're forced to pass the host addresses twice when the service creation and the building request. It's not DRY.

Are there any reasons that the Host header automatically set that given to the Service?

Contributor Guide