# Catch-all for all https traffic into one container?

**URL:** <https://community.traefik.io/t/catch-all-for-all-https-traffic-into-one-container/18971>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [June 15, 2023, 1:15pm UTC](https://community.traefik.io/t/catch-all-for-all-https-traffic-into-one-container/18971 "2023-06-15T13:15:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andio](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/andio/32/7247_2.png) [@andio](https://community.traefik.io/u/andio)\
**Post date:** [June 15, 2023, 1:15pm UTC](https://community.traefik.io/t/catch-all-for-all-https-traffic-into-one-container/18971/1 "2023-06-15T13:15:38Z")

</div>

I am using Traefik with docker and docker-compose and have configured an https web server with a hostname.

```auto
      - traefik.http.routers.portal-production.priority=1
      - traefik.http.routers.portal-production.rule=host(`some.host.name`)
      - traefik.http.routers.portal-production.tls=true
      - traefik.http.routers.portal-production.tls.certresolver=autocert
      - traefik.http.services.portal-production-service.loadbalancer.server.port=80

```

This works fine.

**In addition** , I want to direct all https accesses, whether there is a hostname in the request or not (access via IP address only) to this Docker container as well. The reason for this is that some users do not access my service with the hostname, but only with https:// i.e. IP address only. Currently these users get the default 404 Not Found page.

How can I direct all https accesses to the container?  
My service is the only one on the server, so all https accesses could be directed into the container, and there must also be only one certificate for the specified hostname.

I would be very grateful for any hints.

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 15, 2023, 7:20pm UTC](https://community.traefik.io/t/catch-all-for-all-https-traffic-into-one-container/18971/2 "2023-06-15T19:20:44Z")

</div>

You can’t use IPs for TLS, the certs are linked to domain names, the browsers will show an error. It still works, but provides a bad UX.

For a TLS catchall rule you can use `HostSNI(`*`)`. But you need to provide valid certs for every domain, so best is a wildcard cert, which you can only get from LetsEncrypt with dnsChallenge.

---

<div class="post-metadata">

**Author:** ![andio](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/andio/32/7247_2.png) [@andio](https://community.traefik.io/u/andio)\
**Post date:** [June 16, 2023, 8:40am UTC](https://community.traefik.io/t/catch-all-for-all-https-traffic-into-one-container/18971/3 "2023-06-16T08:40:12Z")

</div>

Thanks a lot for your response.

I am aware that this will result in an error message. However, we are talking about requests that are sent from scripts or from an intranet with different NATs in between. The users there have no possibility to make a DNS entry, so they can only call the IP.

From my side I want to deliver only the one standard certificate, which is also regularly used for the one hostname.

I have already tried with HostSNI('\*') but no success. Can you be more specific about what this should look like? So a default hostname should be used (see my code above) but furthermore the access should be possible only to the IP.

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 16, 2023, 2:17pm UTC](https://community.traefik.io/t/catch-all-for-all-https-traffic-into-one-container/18971/4 "2023-06-16T14:17:41Z")

</div>

When you have a paid TLS cert, then you can tell Traefik to use it as default ([doc](https://doc.traefik.io/traefik/https/tls/#default-certificate)). However I am not sure how you could tell Traefik to use a LetsEncrypt cert for other non-matching hosts, as Traefik usually creates a custom own TLS cert.

Maybe try  
`.rule=Host(`example.com`) || HostSNI(`*`)`
