Skip to content

Instantly share code, notes, and snippets.

@scottcagno
Created October 16, 2015 17:27
Show Gist options
  • Select an option

  • Save scottcagno/5cff345901b71ff14138 to your computer and use it in GitHub Desktop.

Select an option

Save scottcagno/5cff345901b71ff14138 to your computer and use it in GitHub Desktop.
golang http cors handler/wrapper
func HandleCORS(fn http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
fn(w, r)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment