fix CORS
This commit is contained in:
parent
75c3a98f33
commit
5b1a94c735
@ -86,6 +86,7 @@ const (
|
||||
|
||||
func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set(`Server`, SERVER_HEADER)
|
||||
w.Header().Set(`Access-Control-Allow-Origin`, `*`) // Blanket allow CORS
|
||||
if this.opts.MaxUploadBytes > 0 {
|
||||
r.Body = http.MaxBytesReader(w, r.Body, this.opts.MaxUploadBytes)
|
||||
}
|
||||
@ -108,8 +109,7 @@ func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
this.handleUpload(w, r)
|
||||
|
||||
} else if r.Method == "OPTIONS" {
|
||||
// Blanket allow
|
||||
w.Header().Set(`Access-Control-Allow-Origin`, `*`)
|
||||
// Blanket allow (headers already set)
|
||||
w.WriteHeader(200)
|
||||
|
||||
} else if r.Method == "GET" && r.URL.Path == `/` {
|
||||
|
Loading…
Reference in New Issue
Block a user