mirror of
https://github.com/Luzifer/ots.git
synced 2025-04-18 22:45:57 -04:00
Add CORS handling for /api/create endpoint
Signed-off-by: Quincy Mast <email.quincymast@gmail.com>
This commit is contained in:
parent
8fadf7205f
commit
1b29e6ae8f
7
api.go
7
api.go
@ -56,6 +56,13 @@ func (a apiServer) Register(r *mux.Router) {
|
||||
}
|
||||
|
||||
func (a apiServer) handleCreate(res http.ResponseWriter, r *http.Request) {
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user