Skip to content

Commit

Permalink
Fixed #415
Browse files Browse the repository at this point in the history
- Fixed UI issue on the HSTS toggle
- Added error message on save error for HSTS
  • Loading branch information
tobychui committed Dec 6, 2024
1 parent c39af1f commit 24371ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/reverseproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,11 @@ func HandleHSTSState(w http.ResponseWriter, r *http.Request) {

if newMaxAge == 0 || newMaxAge >= 31536000 {
targetProxyEndpoint.HSTSMaxAge = int64(newMaxAge)
SaveReverseProxyConfig(targetProxyEndpoint)
err = SaveReverseProxyConfig(targetProxyEndpoint)
if err != nil {
utils.SendErrorResponse(w, "save HSTS state failed: "+err.Error())
return
}
targetProxyEndpoint.UpdateToRuntime()
} else {
utils.SendErrorResponse(w, "invalid max age given")
Expand Down
2 changes: 1 addition & 1 deletion src/web/snippet/customHeaders.html
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ <h4>Permission Policy</h4>
method: "POST",
data: {
"domain": editingEndpoint.ep,
"maxage": 31536000
"maxage": HSTSEnabled?31536000:0,
},
success: function(data){
if (data.error != undefined){
Expand Down

0 comments on commit 24371ed

Please sign in to comment.