Merge 1e3d10c1aea807314dbc09e9b24c14f15ceda38c into 45184a496e33a21c2745c5e0431a47503afd9891

This commit is contained in:
mastqe 2025-03-12 15:26:34 +01:00 committed by GitHub
commit 4b7adb5fad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

10
api.go
View File

@ -56,6 +56,16 @@ func (a apiServer) Register(r *mux.Router) {
}
func (a apiServer) handleCreate(res http.ResponseWriter, r *http.Request) {
if cust.AddCORSHeaders {
res.Header().Set("Access-Control-Allow-Origin", "*")
res.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS")
if r.Method == http.MethodOptions {
res.WriteHeader(http.StatusNoContent)
return
}
}
if cust.MaxSecretSize > 0 {
// As a safeguard against HUGE payloads behind a misconfigured
// proxy we take double the maximum secret size after which we

View File

@ -41,6 +41,7 @@ type (
MetricsAllowedSubnets []string `json:"-" yaml:"metricsAllowedSubnets"`
OverlayFSPath string `json:"-" yaml:"overlayFSPath"`
UseFormalLanguage bool `json:"-" yaml:"useFormalLanguage"`
AddCORSHeaders bool `json:"-" yaml:"addCORSHeaders"`
FooterLinks []FooterLink `json:"footerLinks,omitempty" yaml:"footerLinks"`
}