Distribute and handle challenge.json

This commit is contained in:
nemunaire 2022-05-01 22:33:59 +02:00
parent e8f6a03cd9
commit dff4f4eb63
20 changed files with 167 additions and 48 deletions

View file

@ -107,6 +107,14 @@ func init() {
fwd_request(w, r, "http://127.0.0.1:8081/")
}
})
api.Router().GET("/challenge.json", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
w.Header().Set("Cache-Control", "no-cache")
if forwarder != nil {
fwd_request(w, r, *forwarder)
} else {
http.ServeFile(w, r, path.Join(settings.SettingsDir, settings.ChallengeFile))
}
})
api.Router().GET("/settings.json", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
w.Header().Set("Cache-Control", "no-cache")
if forwarder != nil {