util/httputil/cors.go
func SetCORS(w http.ResponseWriter, o *regexp.Regexp, r *http.Request) {
	origin := r.Header.Get("Origin")
	if origin == "" {
		return
	}

	for k, v := range corsHeaders {
		w.Header().Set(k, v)
	}

	if o.String() == "^(?:.*)$" {
		w.Header().Set("Access-Control-Allow-Origin", "*")
		return
	}

	if o.MatchString(origin) {
		w.Header().Set("Access-Control-Allow-Origin", origin)
	}
}
func SetCORS(w http.ResponseWriter, o *regexp.Regexp, r *http.Request) {
	origin := r.Header.Get("Origin")
	if origin == "" {
		return
	}

	for k, v := range corsHeaders {
		w.Header().Set(k, v)
	}

	if o.String() == "^(?:.*)$" {
		w.Header().Set("Access-Control-Allow-Origin", "*")
		return
	}

	if o.MatchString(origin) {
		w.Header().Set("Access-Control-Allow-Origin", origin)
	}
}
func SetCORS ( w http . ResponseWriter , o * regexp . Regexp , r * http . Request ) { origin := r . Header . Get ( " " ) if origin == " " { return } for k , v := range corsHeaders { w . Header ( ) . Set ( k , v ) } if o . String ( ) == " " { w . Header ( ) . Set ( " " , " " ) return } if o . MatchString ( origin ) { w . Header ( ) . Set ( " " , origin ) } }
// Enables cross-site script calls.
Enables cross - site script calls .