forked from Ivasoft/traefik
Compare commits
5 Commits
v1.0.alpha
...
v1.0.alpha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f10bbd8c69 | ||
|
|
6bcb6f92f5 | ||
|
|
f6b5684a5b | ||
|
|
866e8db5f7 | ||
|
|
a9925c7521 |
@@ -243,6 +243,11 @@ address = ":8080"
|
||||
#
|
||||
# CertFile = "traefik.crt"
|
||||
# KeyFile = "traefik.key"
|
||||
#
|
||||
# Set REST API to read-only mode
|
||||
#
|
||||
# Optional
|
||||
# ReadOnly = false
|
||||
```
|
||||
|
||||
- `/`: provides a simple HTML frontend of Træfik
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
[frontends.frontend{{.ID | replace "/" "-"}}]
|
||||
backend = "backend{{.ID | replace "/" "-"}}"
|
||||
passHostHeader = {{getPassHostHeader .}}
|
||||
[frontends.frontend-{{.ID | replace "/" ""}}.routes.route-host-{{.ID | replace "/" ""}}]
|
||||
[frontends.frontend{{.ID | replace "/" "-"}}.routes.route-host{{.ID | replace "/" "-"}}]
|
||||
rule = "{{getFrontendRule .}}"
|
||||
value = "{{getFrontendValue .}}"
|
||||
{{end}}
|
||||
6
web.go
6
web.go
@@ -19,6 +19,7 @@ import (
|
||||
type WebProvider struct {
|
||||
Address string
|
||||
CertFile, KeyFile string
|
||||
ReadOnly bool
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -40,6 +41,11 @@ func (provider *WebProvider) Provide(configurationChan chan<- types.ConfigMessag
|
||||
systemRouter.Methods("GET").Path("/api/providers").HandlerFunc(getConfigHandler)
|
||||
systemRouter.Methods("GET").Path("/api/providers/{provider}").HandlerFunc(getProviderHandler)
|
||||
systemRouter.Methods("PUT").Path("/api/providers/{provider}").HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
|
||||
if provider.ReadOnly {
|
||||
response.WriteHeader(http.StatusForbidden)
|
||||
fmt.Fprintf(response, "REST API is in read-only mode")
|
||||
return
|
||||
}
|
||||
vars := mux.Vars(request)
|
||||
if vars["provider"] != "web" {
|
||||
response.WriteHeader(http.StatusBadRequest)
|
||||
|
||||
Reference in New Issue
Block a user