Skip to content

Commit

Permalink
Restart caddy after adding HSTS
Browse files Browse the repository at this point in the history
  • Loading branch information
pondzix committed Jan 29, 2024
1 parent 86ada33 commit e935a30
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions provisioning/resources/control-plane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,15 @@ func addHsts(resp http.ResponseWriter, req *http.Request) {
err := addHstsHeader(config.ConfigNames.Caddy)
if err != nil {
http.Error(resp, err.Error(), 500)
} else {
resp.WriteHeader(http.StatusOK)
io.WriteString(resp, "OK")
return
}
err, status := restartSPService("caddy")
if err != nil {
http.Error(resp, err.Error(), status)
return
}
resp.WriteHeader(http.StatusOK)
io.WriteString(resp, "OK")
} else {
// Return 404 for other methods
http.Error(resp, "", 404)
Expand Down

0 comments on commit e935a30

Please sign in to comment.