I have following CORS configuration
headersOk := handlers.AllowedHeaders([]string{“Authorization”, “Content-Type”, “Origin”, “Accept”, “Accept-Language”, “Accept-Encoding”, “Cache-Control”, “Content-Length”, “X-Requested-With”})
originsOk := handlers.AllowedOrigins([]string{“http://localhost:8080”, “http://localhost:5000”})
methodsOk := handlers.AllowedMethods([]string{“GET”, “HEAD”, “POST”, “PUT”, “OPTIONS”})
log.Fatal(http.ListenAndServe(":"+port, handlers.CORS(handlers.AllowCredentials(), originsOk, headersOk, methodsOk)(router)))
For the above CORS config, Content-Type:application/json works fine from Javascript XMLHttpRequest but when when the request is Content-Type:multipart/form-data; boundary=someboundary then it throws below error -
Access to XMLHttpRequest at ‘https://example.com/profile/edit’ from origin ‘http://localhost:5000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Please help why multipart/form-data request throws CORS blocker