Troubleshooting: Use Traefik 2.x as ingress controller
| April 20, 2021
All Longhorn versions with Traefik 2.x as ingress controller.
Note that, the CORS problem would not happen with Traefik 1.x as ingress controller.
The Longhorn GUI frontend API requests sometimes failed to reach longhorn-manager backend.
The API requests would change the protocol between HTTPS/WSS, and the change would lead to a CORS problem.
The Traefik 2.x ingress controller does not set the WebSocket headers.
Adds the following middleware to the route for the Longhorn frontend service.
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: svc-longhorn-headers
namespace: longhorn-system
spec:
headers:
customRequestHeaders:
X-Forwarded-Proto: "https"
Updates the ingress to use the middleware rule.
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: longhorn-ingress
namespace: longhorn-system
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
traefik.ingress.kubernetes.io/router.middlewares: longhorn-system-svc-longhorn-headers@kubernetescrd
spec:
rules:
- http:
paths:
- path: /
backend:
serviceName: longhorn-frontend
servicePort: 80
Recent articles
Copyright © 2019-2026 Longhorn a Series of LF Projects, LLC. Documentation Distributed under CC-BY-4.0.
The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
For website terms of use, trademark policy and other project policies please see lfprojects.org/policies.