# Traefik should response with 503 instead of 404 for requests to unregistered consul services

**URL:** https://community.traefik.io/t/traefik-should-response-with-503-instead-of-404-for-requests-to-unregistered-consul-services/20183
**Category:** Traefik v2
**Tags:** consul-catalog, middleware
**Created:** [October 18, 2023, 2:11pm UTC](https://community.traefik.io/t/traefik-should-response-with-503-instead-of-404-for-requests-to-unregistered-consul-services/20183 "2023-10-18T14:11:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![lsander](https://avatars.discourse-cdn.com/v4/letter/l/53a042/32.png) [@lsander](https://community.traefik.io/u/lsander)
#### Post date: [October 18, 2023, 2:11pm UTC](https://community.traefik.io/t/traefik-should-response-with-503-instead-of-404-for-requests-to-unregistered-consul-services/20183/1 "2023-10-18T14:11:59Z")

</div>

Hello dear Traefik community,  
I have a question about my Traefik setup. We are using Traefik as a proxy to reach our services in Hashicorp Nomad. The services register in Consul, which allows Traefik to get the Nomad services and other information like destination IP and port via the Consul Catalog.  
We need to make sure that even if an application has a "Dead" status in Nomad, and thus is not registered in Consul, Traefik will respond with a 503 code and not 404.  
For this I made exactly the changes described in the Traefik FAQ:

> **[Traefik Getting Started FAQ - Traefik](https://doc.traefik.io/traefik/getting-started/faq/#404-not-found)**
>
> Check out our FAQ page for answers to commonly asked questions on getting started with Traefik Proxy. Read the technical documentation.

Unfortunately Traefik still refuses to send the requested code and stays with the 404.  
Does anyone here maybe have an idea what I have overlooked?  
Or is there a better solution than implementing a CatchAll rule in the meantime?

Traefik Configuration:

- traefik.toml

```auto
[respondingTimeouts]
  writeTimeout = "300s"

[entryPoints]
 [entryPoints.http]
  address=":80"
 [entryPoints.http8080]
  address=":8080"

[entryPoints.http.forwardedHeaders]
insecure = true

[entryPoints.http8080.forwardedHeaders]
insecure = true

[entryPoints.traefik]
  address=":8081"

[api]
  dashboard=true
  insecure=true

[providers.consulCatalog]
  refreshInterval="1s"
  prefix="traefik"
  exposedByDefault=false
[providers.consulCatalog.endpoint]
  address="127.0.0.1:8500"
  scheme="http"
[log]
  level="ERROR"

[accessLog]
 [accessLog.fields.headers]
 defaultMode = "keep"
[providers.file]
  filename="dynamic.yaml"

```

- dynamic.yaml

```auto
http:
  routers:
    catchall:
      # attached only to web entryPoint
      entryPoints:
        - "http"
        - "http8080"
      # catchall rule
      rule: "PathPrefix(`/`)"
      service: unavailable
      # lowest possible priority
      # evaluated when no other router is matched
      priority: 1

  services:
    # Service that will always answer a 503 Service Unavailable response
    unavailable:
      loadBalancer:
        servers: {}

```

---

<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: [October 18, 2023, 2:52pm UTC](https://community.traefik.io/t/traefik-should-response-with-503-instead-of-404-for-requests-to-unregistered-consul-services/20183/2 "2023-10-18T14:52:49Z")

</div>

Do you have a `providers.file` to read the dynamic config file?

---

<div class="post-metadata">

### Author: ![lsander](https://avatars.discourse-cdn.com/v4/letter/l/53a042/32.png) [@lsander](https://community.traefik.io/u/lsander)
#### Post date: [October 18, 2023, 3:04pm UTC](https://community.traefik.io/t/traefik-should-response-with-503-instead-of-404-for-requests-to-unregistered-consul-services/20183/3 "2023-10-18T15:04:24Z")

</div>

yes, it's at the bottom of the traefik.toml

---

<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: [October 18, 2023, 3:26pm UTC](https://community.traefik.io/t/traefik-should-response-with-503-instead-of-404-for-requests-to-unregistered-consul-services/20183/4 "2023-10-18T15:26:36Z")

</div>

Did you check the log, is it read? I trust more in absolute file names with full path.

---

<div class="post-metadata">

### Author: ![lsander](https://avatars.discourse-cdn.com/v4/letter/l/53a042/32.png) [@lsander](https://community.traefik.io/u/lsander)
#### Post date: [October 18, 2023, 4:55pm UTC](https://community.traefik.io/t/traefik-should-response-with-503-instead-of-404-for-requests-to-unregistered-consul-services/20183/5 "2023-10-18T16:55:07Z")

</div>

Yep... that's it...  
Thanks a lot! Well -at least I could learn a lot about traefik 😃

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)
#### Post date: [October 21, 2023, 4:55pm UTC](https://community.traefik.io/t/traefik-should-response-with-503-instead-of-404-for-requests-to-unregistered-consul-services/20183/6 "2023-10-21T16:55:47Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
