I'm having trouble with an API I have configured. I need to have Kong preserve the Host header I send and forward to my upstream_url. That is not happening though and Kong is substituting the upstream_url scheme:host:port instead. I'm running Kong 0.7.0.
Here is my current API end config in Kong:
{
"data": [
{
"request_path": "/v1/test-api",
"id": "13664E93-3A58-429B-818B-1204934E116E",
"created_at": 1459539371000,
"preserve_host": true,
"name": "test-api",
"request_host": ""
}
],
"total": 1
}
I'm trying to call the API as follows:
-H "X-Forwarded-For: 10.17.20.174" \
Kong is returning the following error:
HTTP/1.1 502 Bad Gateway
Date: Wed, 06 Apr 2016 13:52:01 GMT
Content-Type: text/plain; charset=UTF-8
Transfer-Encoding: chunked
Connection: close
Server: kong/0.7.0
An invalid response was received from the upstream server
I've done a package capture on the Kong server and these are the headers that are being sent from Kong:
GET /v1/test-api HTTP/1.0
X-Real-IP: 10.17.20.174
X-Forwarded-For: 10.17.20.174, 10.17.20.174
X-Forwarded-Proto: http
Host: lb-api.mycompany.com:3000
Connection: close
X-Forwarded-Host: fb1.api.mycompany.com
User-Agent: Paw/2.3.3 (Macintosh; OS X/10.10.5) GCDHTTPRequest
I am expecting the Host header to be this:
"Host: f1.api.mycompany.com"
I've tried changing the APIs "preserve_host" to false and still get the same response.
Has anybody else seen this problem? Or is my understanding of how the the Host header is forward incorrect?
-Erik