Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions code/go/0chain.net/blobbercore/handler/handler_middlewares.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ import (
)

func useCors(h http.Handler) http.Handler {
allowedHeaders := []string{
"X-Requested-With", "Content-Type",
"X-App-Client-ID", "X-App-Client-Key", "X-App-Client-Signature",
"Access-Control-Allow-origin", "Access-Control-Request-Method",
}

allowedOrigins := []string{"*"}

allowedMethods := []string{"GET", "HEAD", "POST", "PUT",
"DELETE", "OPTIONS"}
Expand All @@ -27,8 +20,8 @@ func useCors(h http.Handler) http.Handler {
}
}()

w.Header().Add("Access-Control-Allow-Headers", strings.Join(allowedHeaders, ", "))
w.Header().Add("Access-Control-Allow-Origin", strings.Join(allowedOrigins, ", "))
w.Header().Add("Access-Control-Allow-Headers", "*")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change from limited headers to allow all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. It is unnecessary to limit some headers for it

w.Header().Add("Access-Control-Allow-Origin", "*")
w.Header().Add("Access-Control-Allow-Methods", strings.Join(allowedMethods, ", "))
w.Header().Add("Access-Control-Allow-Credentials", "true")

Expand Down