Search code examples
kubernetestraefikkubernetes-ingresstraefik-ingress

Is it possible to set the default frontend rule type?


https://docs.traefik.io/configuration/backends/kubernetes/#general-annotations Says that the traefik.ingress.kubernetes.io/rule-type annotation overrides the the default frontend rule type.

Is there any way to set the default frontend rule type to PathPrefixStrip so I will not have to override it in every single Ingress definition?


Solution

  • No, in traefik 1.7 default fronted rule is hardcoded and not documented. https://github.com/containous/traefik/blob/v1.7/provider/kubernetes/kubernetes.go#L48

        defaultFrontendRule        = "PathPrefix:/"
    //...
    
                    if len(frontend.Routes) == 0 {
                        frontend.Routes["/"] = types.Route{
                            Rule: defaultFrontendRule,
                        }
                    }
    //...
        templateObjects.Frontends[defaultFrontendName].Routes["/"] = types.Route{
            Rule: defaultFrontendRule,
        }