# Having an issue with SSLProxyHeaders Headers Middleware

**URL:** <https://community.traefik.io/t/having-an-issue-with-sslproxyheaders-headers-middleware/11242>\
**Category:** Traefik v2\
**Tags:** middleware, kubernetes-crd\
**Created:** [July 20, 2021, 3:05pm UTC](https://community.traefik.io/t/having-an-issue-with-sslproxyheaders-headers-middleware/11242 "2021-07-20T15:05:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tristan43](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@tristan43](https://community.traefik.io/u/tristan43)\
**Post date:** [July 20, 2021, 3:05pm UTC](https://community.traefik.io/t/having-an-issue-with-sslproxyheaders-headers-middleware/11242/1 "2021-07-20T15:05:25Z")

</div>

I am using Traefik proxy 2.2.0 with Kubernetes CRD. I have defined a middleware as follows:

```auto
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: forwarded-proto-https
spec:
  headers:
    sslProxyHeaders:
      X-Forwarded-Proto: "https"

```

I have applied this middlware to an Ingress Route as follows:

```auto
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: ingress-route-name
  namespace: ingress-route-namespace
spec:
  entryPoints:
  - websecure
  routes:
  - kind: Rule
    match: Host(`dev.domain.com`)
    middlewares:
    - name: forwarded-proto-https
      namespace: default
    services:
    - name: svc-name
      port: 80
  tls:
    options:
      name: tls-default
      namespace: default

```

However, this results in a 404 when applied. When I remove the middlewares section of the IngressRoute definition it works just fine. Any thoughts on what I am doing incorrectly here?

Thanks.

---

<div class="post-metadata">

**Author:** ![daniel.tomcej](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/daniel.tomcej/32/262_2.png) [@daniel.tomcej](https://community.traefik.io/u/daniel.tomcej)\
**Post date:** [July 20, 2021, 4:38pm UTC](https://community.traefik.io/t/having-an-issue-with-sslproxyheaders-headers-middleware/11242/2 "2021-07-20T16:38:33Z")

</div>

Hello @tristan43,

It appears that you have configured a TLS enabled ingressroute, which you mention works correctly without the headers middleware.

The `sslProxyHeaders` setting is used to determine whether a request is SSL or not...Since I doubt your SSL request sets an X-forwarded-proto header, the middleware would break the chain, since it would no longer be treated as an SSL request.

Is your intention to add the `X-forwarded-proto` header to the backend request? if so, Traefik does that automatically.

---

<div class="post-metadata">

**Author:** ![tristan43](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@tristan43](https://community.traefik.io/u/tristan43)\
**Post date:** [July 22, 2021, 6:59pm UTC](https://community.traefik.io/t/having-an-issue-with-sslproxyheaders-headers-middleware/11242/3 "2021-07-22T18:59:25Z")

</div>

Thank you. Yes my intention was to add the X-Forwarded-Proto header to the backend. I did not realize it happened automatically. Can you point me to the docs for that? It'll help in the future. Thanks so much.

---

<div class="post-metadata">

**Author:** ![daniel.tomcej](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/daniel.tomcej/32/262_2.png) [@daniel.tomcej](https://community.traefik.io/u/daniel.tomcej)\
**Post date:** [July 22, 2021, 7:57pm UTC](https://community.traefik.io/t/having-an-issue-with-sslproxyheaders-headers-middleware/11242/4 "2021-07-22T19:57:44Z")

</div>

Hello @tristan43,

I could have sworn that the docs used to contain that information, but it may not have been migrated when we released the v2 docs.

I opened a new documentation issue to add this to the docs, as it should be there: ([Documentation does not list proxy headers that are automatically added · Issue #8294 · traefik/traefik · GitHub](https://github.com/traefik/traefik/issues/8294)).
