Getting 404 for recognised router

We've recently set-up faasd on a host and then used the Consul CLI to register it as a service for the Consul-Catalog. As part of this registration, I added in the required tags for Traefik, however when trying to navigate to the configured address we're being met with a 404 page not found error. After checking the logs for Traefik I can see that it has resolved the correct route but is still outputting the error.

Redacted tags used with Consul registration:

"tags": [
        "traefik.enable=true",
        "traefik.http.routers.openfaas.rule=Host(`host.example.com`) && PathPrefix(`/openfaas`)",
        "traefik.http.routers.openfaas.service=openfaas@consulcatalog",
        "traefik.http.routers.openfaas.entrypoints=websecure, web",
      ]

Traefik logs that show it identifying the correct route:

[31/Jan/2022:11:33:06 +0000] "GET /openfaas/ HTTP/1.1" 404 19 "-" "-" 4770 "openfaas@consulcatalog" "http://x.x.x.x:8085" 1ms
[31/Jan/2022:11:45:21 +0000] "GET /openfaas/ HTTP/1.1" 404 19 "-" "-" 4771 "openfaas@consulcatalog" "http://x.x.x.x:8085" 1ms
[31/Jan/2022:11:45:30 +0000] "GET /openfaas/ui/ HTTP/1.1" 404 19 "-" "-" 4772 "openfaas@consulcatalog" "http://x.x.x.x:8085" 0ms

I've directly curled the service's address from the server running Traefik and received a 301 response back (as expected):

curl -v http://x.x.x.x:8085
* Rebuilt URL to: http://x.x.x.x:8085/
*   Trying x.x.x.x...
* TCP_NODELAY set
* Connected to x.x.x.x (x.x.x.x) port 8085 (#0)
> GET / HTTP/1.1
> Host: x.x.x.x:8085
> User-Agent: curl/7.61.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Content-Type: text/html; charset=utf-8
< Location: /ui/
< Date: Mon, 31 Jan 2022 13:31:17 GMT
< Content-Length: 39
<
<a href="/ui/">Moved Permanently</a>.

* Connection #0 to host x.x.x.x left intact

We're running Traefik binary version 2.5.3 as a service on a Rhel8.4 host which routes to an external Rhel8.4 host that has faasd version 0.14.4 running there. Other routes have been setup and are working fine. If anyone can help identify or solve the problem please.

Found out this is because the /openfaas/ path was being passed down to the service, so the service was returning 404 as it was an unknown path.

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