# Missing X-Forwarded-Proto

**URL:** <https://discuss.konghq.com/t/missing-x-forwarded-proto/7984>\
**Category:** Questions\
**Tags:** kubernetes\
**Created:** [March 3, 2021, 6:31am UTC](https://discuss.konghq.com/t/missing-x-forwarded-proto/7984 "2021-03-03T06:31:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpelesh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/mpelesh/32/2603_2.png) [@mpelesh](https://discuss.konghq.com/u/mpelesh)\
**Post date:** [March 3, 2021, 6:31am UTC](https://discuss.konghq.com/t/missing-x-forwarded-proto/7984/1 "2021-03-03T06:31:36Z")

</div>

I am using Kong Ingress controller with TLS termination. Looks like X-Forwarded-Proto is not set by Kong. Other X-Forwarded-\* headers are there. This is incoming request in httpbin container:

```
{
"args": {},
"data": "",
"files": {},
"form": {},
"headers": {
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
    "Accept-Encoding": "gzip, deflate, br",
    "Accept-Language": "en-US,en;q=0.9,uk;q=0.8",
    "Cache-Control": "no-cache",
    "Connection": "keep-alive",
    "Host": "localhost",
    "Pragma": "no-cache",
    "Sec-Ch-Ua": "\"Chromium\";v=\"88\", \"Google Chrome\";v=\"88\", \";Not A Brand\";v=\"99\"",
    "Sec-Ch-Ua-Mobile": "?0",
    "Sec-Fetch-Dest": "document",
    "Sec-Fetch-Mode": "navigate",
    "Sec-Fetch-Site": "none",
    "Sec-Fetch-User": "?1",
    "Sec-Gpc": "1",
    "Upgrade-Insecure-Requests": "1",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36",
    "X-Forwarded-Host": "localhost",
    "X-Forwarded-Path": "/httpbin/anything",
    "X-Forwarded-Prefix": "/httpbin"
},
"json": null,
"method": "GET",
"origin": "<IP address>",
"url": "https://localhost/anything"

```

}

Am I missing something in my config?  
Helm chart version 1.14.3. App version 2.2.

---

<div class="post-metadata">

**Author:** ![traines](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/traines/32/158_2.png) [@traines](https://discuss.konghq.com/u/traines)\
**Post date:** [March 5, 2021, 12:45am UTC](https://discuss.konghq.com/t/missing-x-forwarded-proto/7984/2 "2021-03-05T00:45:55Z")

</div>

This appears to be something inherent to httpbin. If I try to ignore Kong altogether and send that header directly to it via a port-forward, it still disappears:

```auto
kubectl port-forward svc/httpbin 8999:80

```

```auto
$ http -v localhost:8999/anything X-Forwarded-Proto:https 
GET /anything HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:8999
User-Agent: HTTPie/2.4.0
X-Forwarded-Proto: https

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 352
Content-Type: application/json
Date: Fri, 05 Mar 2021 00:29:57 GMT
Server: gunicorn/19.9.0

{
    "args": {},
    "data": "",
    "files": {},
    "form": {},
    "headers": {
        "Accept": "*/*",
        "Accept-Encoding": "gzip, deflate",
        "Connection": "keep-alive",
        "Host": "localhost:8999",
        "User-Agent": "HTTPie/2.4.0"
    },
    "json": null,
    "method": "GET",
    "origin": "127.0.0.1",
    "url": "https://localhost:8999/anything"
}

```

The [HTTP echo server used in the Minikube example](https://kubernetes.io/docs/tutorials/hello-minikube/#create-a-deployment) does echo it:

```auto
HEADERS RECEIVED:
accept=*/*
accept-encoding=gzip, deflate
connection=keep-alive
host=localhost:8999
user-agent=HTTPie/2.4.0
x-forwarded-proto=https

```

On the Kong end, that header should [always be set to the contents of the `upstream_x_forwarded_proto` variable](https://github.com/Kong/kong/blob/2.2.2/kong/templates/nginx_kong.lua#L147). That variable [is set](https://github.com/Kong/kong/blob/2.2.2/kong/runloop/handler.lua#L1245) to [either the inbound client protocol or inbound `X-Forwarded-Proto`](https://github.com/Kong/kong/blob/2.2.2/kong/runloop/handler.lua#L1134-L1146). You can overwrite that variable with a plugin after, but it should always be set otherwise.

---

<div class="post-metadata">

**Author:** ![mpelesh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/mpelesh/32/2603_2.png) [@mpelesh](https://discuss.konghq.com/u/mpelesh)\
**Post date:** [March 8, 2021, 5:57pm UTC](https://discuss.konghq.com/t/missing-x-forwarded-proto/7984/3 "2021-03-08T17:57:47Z")

</div>

Thank you, @traines . I also figured this out with Wireshark. Indeed it is a problem with httbin (or Gunicorn it is using). All headers are there.
