fix: debug endpoint when insecure API.
This commit is contained in:
parent
bc063ad773
commit
ddbf4470a1
3 changed files with 18 additions and 0 deletions
|
@ -21,6 +21,14 @@
|
||||||
"rule": "PathPrefix(`/`)",
|
"rule": "PathPrefix(`/`)",
|
||||||
"priority": 2147483645
|
"priority": 2147483645
|
||||||
},
|
},
|
||||||
|
"debug": {
|
||||||
|
"entryPoints": [
|
||||||
|
"traefik"
|
||||||
|
],
|
||||||
|
"service": "api@internal",
|
||||||
|
"rule": "PathPrefix(`/debug`)",
|
||||||
|
"priority": 2147483646
|
||||||
|
},
|
||||||
"ping": {
|
"ping": {
|
||||||
"entryPoints": [
|
"entryPoints": [
|
||||||
"test"
|
"test"
|
||||||
|
|
|
@ -95,6 +95,15 @@ func (i *Provider) apiConfiguration(cfg *dynamic.Configuration) {
|
||||||
StripPrefix: &dynamic.StripPrefix{Prefixes: []string{"/dashboard/", "/dashboard"}},
|
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{}
|
cfg.HTTP.Services["api"] = &dynamic.Service{}
|
||||||
|
|
|
@ -28,6 +28,7 @@ func Test_createConfiguration(t *testing.T) {
|
||||||
API: &static.API{
|
API: &static.API{
|
||||||
Insecure: true,
|
Insecure: true,
|
||||||
Dashboard: true,
|
Dashboard: true,
|
||||||
|
Debug: true,
|
||||||
},
|
},
|
||||||
Ping: &ping.Handler{
|
Ping: &ping.Handler{
|
||||||
EntryPoint: "test",
|
EntryPoint: "test",
|
||||||
|
|
Loading…
Reference in a new issue