JWT AntPath is a middleware plugin for Traefik which verify JWT excludes configured path, and add payload to header
/
as separator*
as wildcard**
as recursive wildcardpaths:- /base/app-home/**- /*/doc/**- /foo/*/doc/**- /foo/*
paths:- /**/app-home/**- /**/app-home/*- /**/doc/**- /**/doc/*- /foo/**/doc/**
experimental:plugins:traefik-plugin-jwt-antpath:moduleName: "github.com/x-ream/traefik-plugin-jwt-antpath"version: "v0.1.2"
apiVersion: traefik.containo.us/v1alpha1kind: Middlewaremetadata:name: my-jwtantpathspec:plugin:traefik-plugin-jwt-antpath:headerKey: "Authorization"secureKey: "my-secret-key"paths:- /base/app-home/**
ingress:enabled: trueannotations:traefik.ingress.kubernetes.io/router.entrypoints: webtraefik.ingress.kubernetes.io/router.middlewares: test-my-jwtantpath@kubernetescrd,test-strip-prefix@kubernetescrdingressClassName: traefikhosts:- host: myapp.compaths:- path: /basepathType: "Prefix"
[experimental.plugins.traefik-plugin-jwt-antpath]modulename = "github.com/x-ream/traefik-plugin-jwt-antpath"version = "v0.1.2"
To configure the JWT AntPath
plugin you should create a middleware in
your dynamic configuration as explained here. The following example creates
and uses the JWT AntPath
middleware plugin to verify token and add payload to header of all HTTP requests exclude path starting with /foo
.
[http.routers][http.routers.my-router]rule = "Host(`localhost`)"middlewares = ["jwtantpath"]service = "my-service"# Very jwt exclude all paths starting with /foo[http.middlewares][http.middlewares.foo.plugin.traefik-plugin-jwt-antpath]secureKey = "my-secret-key"headerKey = "Authorization"paths = ["/foo/**", "/*/goods/**"][http.services][http.services.my-service][http.services.my-service.loadBalancer][[http.services.my-service.loadBalancer.servers]]url = "http://127.0.0.1"