mirror of
https://github.com/rclone/rclone.git
synced 2025-08-18 01:20:16 +02:00
http: CORS should not be send if not set (#6433)
This commit is contained in:
@@ -173,14 +173,10 @@ func MiddlewareCORS(allowOrigin string) Middleware {
|
||||
|
||||
if allowOrigin != "" {
|
||||
w.Header().Add("Access-Control-Allow-Origin", allowOrigin)
|
||||
} else {
|
||||
w.Header().Add("Access-Control-Allow-Origin", PublicURL(r))
|
||||
w.Header().Add("Access-Control-Request-Method", "POST, OPTIONS, GET, HEAD")
|
||||
w.Header().Add("Access-Control-Allow-Headers", "authorization, Content-Type")
|
||||
}
|
||||
|
||||
// echo back access control headers client needs
|
||||
w.Header().Add("Access-Control-Request-Method", "POST, OPTIONS, GET, HEAD")
|
||||
w.Header().Add("Access-Control-Allow-Headers", "authorization, Content-Type")
|
||||
|
||||
if r.Method == "OPTIONS" {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
return
|
||||
|
Reference in New Issue
Block a user