# Traefik - 404 - header Host handling

**URL:** <https://community.traefik.io/t/traefik-404-header-host-handling/6885>\
**Category:** Traefik v2\
**Tags:** tcp\
**Created:** [July 13, 2020, 4:39pm UTC](https://community.traefik.io/t/traefik-404-header-host-handling/6885 "2020-07-13T16:39:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pschittt](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/pschittt/32/2313_2.png) [@Pschittt](https://community.traefik.io/u/Pschittt)\
**Post date:** [July 13, 2020, 4:39pm UTC](https://community.traefik.io/t/traefik-404-header-host-handling/6885/1 "2020-07-13T16:39:29Z")

</div>

Hello,

I'm wondering how traefik match the "Host" condition ?

I have a traefik v2 configuration which seem to work. If I run :  
curl [https://mysite.domain.com](https://mysite.domain.com)

I get the result.

But, if I run :  
curl -k --header "Host:mysite.domain.com" [https://192.168.1.1](https://192.168.1.1)

I get a nice 404 error. I don't what I'm missing here.

PS : 192.168.1.1 is the local IP of traefik  
PPS : -k option for curl is to avoid SSL checks

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [July 13, 2020, 4:42pm UTC](https://community.traefik.io/t/traefik-404-header-host-handling/6885/2 "2020-07-13T16:42:34Z")

</div>

For TLS routers this is matched in the TLS hello.

Use curl's --resolve option and it will be sent correctly:  
`curl --insecure --resolve mysite.domain.com:443:192.168.1.1 https://mysite.domain.com`

---

<div class="post-metadata">

**Author:** ![Pschittt](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/pschittt/32/2313_2.png) [@Pschittt](https://community.traefik.io/u/Pschittt)\
**Post date:** [July 13, 2020, 4:51pm UTC](https://community.traefik.io/t/traefik-404-header-host-handling/6885/3 "2020-07-13T16:51:31Z")

</div>

Thanks, but that's not what I want to achieve.

I want to explicity request with the IP.

It seems that the command  
curl -k --header "Host:mysite.domain.com" [https://192.168.1.1](https://192.168.1.1/)

doesn't work if in the config I use :  
Host(`mysite.domain.com`)  
And works if I use :  
HostHeader(`mysite.domain.com`)

I don't understand the differences between the 2. For the Host config, Traefik doesn't check the Host header parameter ? What does it checks ?

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [July 13, 2020, 8:58pm UTC](https://community.traefik.io/t/traefik-404-header-host-handling/6885/4 "2020-07-13T20:58:52Z")

</div>

HostHeader was recently added. But Host should work. What version of Traefik do you have?  
v2.2.2 - 2.2.4 introduced and fixed some bugs. v2.2.5 Should be good though. I'm currently on 2.2.1 .

I will correct myself. The SNI is only required for certificate selection so the `Host: mysite.domain.com` header should work.

Care to share the config ?

---

<div class="post-metadata">

**Author:** ![Pschittt](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/pschittt/32/2313_2.png) [@Pschittt](https://community.traefik.io/u/Pschittt)\
**Post date:** [July 14, 2020, 9:18am UTC](https://community.traefik.io/t/traefik-404-header-host-handling/6885/5 "2020-07-14T09:18:33Z")

</div>

I'm on version 2.2.5. Few months ago, the problem was not here, but can't remember the version.

About the config, it's pretty simple and classic.  
Traefik.yml :

```auto
entryPoints:
  web:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: web-secure
          scheme: https
  web-secure:
    address: ":443"
    http:
      tls:
        certResolver: le

```

dynamic-conf.yml :

```auto
http:
  routers:
    mysite:
      rule: "Host(`mysite.domain.com`)"
      entryPoints:
        - web-secure
      service: mysite
  services:
    mysite:
      loadBalancer:
        servers:
          - url: "http://192.168.20.10"

```

---

<div class="post-metadata">

**Author:** ![Pschittt](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/pschittt/32/2313_2.png) [@Pschittt](https://community.traefik.io/u/Pschittt)\
**Post date:** [July 14, 2020, 11:43am UTC](https://community.traefik.io/t/traefik-404-header-host-handling/6885/6 "2020-07-14T11:43:56Z")

</div>

Ok found the origin:

> <https://github.com/containous/traefik/pull/7008>
