# Problems encountered when using Middleware

**URL:** <https://community.traefik.io/t/problems-encountered-when-using-middleware/27303>\
**Category:** Traefik v3 (latest)\
**Tags:** middleware\
**Created:** [April 25, 2025, 2:39am UTC](https://community.traefik.io/t/problems-encountered-when-using-middleware/27303 "2025-04-25T02:39:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ForcemCS](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/forcemcs/32/9133_2.png) [@ForcemCS](https://community.traefik.io/u/ForcemCS)\
**Post date:** [April 25, 2025, 2:39am UTC](https://community.traefik.io/t/problems-encountered-when-using-middleware/27303/1 "2025-04-25T02:39:19Z")

</div>

```auto
root@debian:~/authelia# cat cc.yaml 
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: tool-service
  namespace: hdh5
spec:
  entryPoints:
    - websecure
  routes:
    - kind: Rule
      match: Host(`link.h.example.com.cn`)
      priority: 10
      services:
        - name: tool-service
          port: 80
  tls:
    secretName: link-tls

```

When I use only the resources in the OP I can access [https://link.h.example.com.cn](https://link.h.example.com.cn) properly

But when I use the resource below, it returns 404，I think the problem is in the middleware configuration

```auto
root@debian:~/authelia# cat link.yaml 
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: tool-service
  namespace: hdh5
spec:
  entryPoints:
    - websecure
  routes:
    - kind: Rule
      match: Host(`link.h.example.com.cn`)
      middlewares:
        - name: authelia-auth 
          namespace: authelia
      priority: 10
      services:
        - name: tool-service
          port: 80
  tls:
    secretName: link-tls
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: authelia-auth
  namespace: authelia 
spec:
  forwardAuth:
    address: http://authelia.authelia.svc.cluster.local:9091/api/authz/forward-auth?rd=https://op.h.example.com.cn/
    trustForwardHeader: true
    authResponseHeaders:
      - Remote-User
      - Remote-Groups
      - Remote-Name
      - Remote-Email

```

---

<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:** [April 28, 2025, 10:51am UTC](https://community.traefik.io/t/problems-encountered-when-using-middleware/27303/2 "2025-04-28T10:51:40Z")

</div>

Enable and check Traefik access log in JSON format ([doc](https://doc.traefik.io/traefik/observability/access-logs/#format)) during request. Is the right `router` used? Is http error status coming from target `OriginStatus` or Traefik itself?
