Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

middleware error is responding with error http response code though it is redirected to error page to client #10720

Closed
2 tasks done
jainasanthosh2023 opened this issue May 15, 2024 · 1 comment

Comments

@jainasanthosh2023
Copy link

jainasanthosh2023 commented May 15, 2024

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you do?

expecting error middleware to give response code of the error page invocation, instead is always giving the http code error that i am handling in middleware.

ingressroute
  routes:
  - kind: Rule
    match: Host(`traefik-demo-east.corp`) && PathPrefix(`/`)
    middlewares:
    - name: failover-onerror
    services:
    - kind: Service
      name: nginx
      nativeLB: true
      port: 80

middleware:
  errors:
    query: /
    service:
      name: nginx
      namespace: traefik-demo-failover
      port: 80
      scheme: http
    status:
    - 500-599

What did you see instead?

In this example my curl output always giving 502 followed error url response content.
I am expecting client should not be served with 502 response as i am handling to redirect to different service to fulfill the same request.

$ curl -i http://traefik-demo-east.corp
**HTTP/1.1 502 Bad Gateway**
Accept-Ranges: bytes
Content-Length: 639
Content-Type: text/html
Date: Wed, 15 May 2024 09:27:11 GMT
Etag: "66438361-27f"
Last-Modified: Tue, 14 May 2024 15:29:37 GMT
Server: nginx/1.25.5

<!DOCTYPE html>
<html>
<head>
<title>Welcome to failover to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to failover to nginx</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

What version of Traefik are you using?

$ helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
traefik traefik 2 2024-02-02 20:42:25.190390562 +0530 IST deployed traefik-26.0.0 v2.10.6

What is your environment & configuration?

**ingressroute**
  routes:
  - kind: Rule
    match: Host(`traefik-demo-east.corp`) && PathPrefix(`/`)
    middlewares:
    - name: failover-onerror
    services:
    - kind: Service
      name: nginx
      nativeLB: true
      port: 80
---
middleware
  errors:
    query: /
    service:
      name: nginx
      namespace: traefik-demo-failover
      port: 80
      scheme: http
    status:
    - 500-599
---

Add more configuration information here.

If applicable, please paste the log output in DEBUG level

No response

@kevinpollet
Copy link
Member

Duplicate of #2039

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants