Header to add when allowing all CORS on Golang's net / http


func handler(w http.ResponseWriter, r *http.Request) {
   w.Header().Set("Access-Control-Allow-Headers", "*")
   w.Header().Set("Access-Control-Allow-Origin", "*")
   w.Header().Set( "Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS" )

Recommended Posts

Header to add when allowing all CORS on Golang's net / http
How to add sudo when debugging