fix: debug endpoint when insecure API.

This commit is contained in:
Ludovic Fernandez 2019-12-04 15:28:07 +01:00 committed by Traefiker Bot
parent bc063ad773
commit ddbf4470a1
3 changed files with 18 additions and 0 deletions

View file

@ -21,6 +21,14 @@
"rule": "PathPrefix(`/`)",
"priority": 2147483645
},
"debug": {
"entryPoints": [
"traefik"
],
"service": "api@internal",
"rule": "PathPrefix(`/debug`)",
"priority": 2147483646
},
"ping": {
"entryPoints": [
"test"

View file

@ -95,6 +95,15 @@ func (i *Provider) apiConfiguration(cfg *dynamic.Configuration) {
StripPrefix: &dynamic.StripPrefix{Prefixes: []string{"/dashboard/", "/dashboard"}},
}
}
if i.staticCfg.API.Debug {
cfg.HTTP.Routers["debug"] = &dynamic.Router{
EntryPoints: []string{"traefik"},
Service: "api@internal",
Priority: math.MaxInt32 - 1,
Rule: "PathPrefix(`/debug`)",
}
}
}
cfg.HTTP.Services["api"] = &dynamic.Service{}

View file

@ -28,6 +28,7 @@ func Test_createConfiguration(t *testing.T) {
API: &static.API{
Insecure: true,
Dashboard: true,
Debug: true,
},
Ping: &ping.Handler{
EntryPoint: "test",