How to redirect every request not just http?

I want to redirect ALL the requests including GRPC, web sockets, http and all that stuff to the service.
For example argocd doesn't work well with traefik.

kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
  namespace: argocd
  name: argocd-server
spec:
  rules:
  - host: argocd.domain.com
    http:
      paths:
      - backend:
          service:
            name: argocd-server
            port:
              number: 443
        path: /
        pathType: Prefix

According to documentation, I need to redirect gRPC as well, but it doesn't seem to do so.

In some other cases it retuns 502 "Bad Gateway". How do I debug this? the service works fine, because I have tested it but traefik refuses to redirect for some reason.

"Redirect" is an HTTP concept. A redirect works by sending an HTTP response to an HTTP client containing an HTTP header with the new URI. If Traefik sends an HTTP redirect response to a client, the client will no longer be communicating with Traefik.

I don't know much about the gRPC or WebSocket protocols, but I have no reason to assume that they support a similar concept, and if they did it would likely be implemented in a completely different way. Traefik is a proxy first and foremost, so you can proxy HTTP and other TCP connections through it to a backend server, which appears to be what you are doing from your k8s config. You are not doing a redirect! You are doing an HTTP proxy.

To proxy your gRPC and WebSocket connections (which use TCP as their transport), read up on Configuring TCP Routers and Configuring TCP Services in the docs.