Skip to content

Instantly share code, notes, and snippets.

@ckeyer
Created July 4, 2015 08:53
Show Gist options
  • Save ckeyer/79086baee7589a754545 to your computer and use it in GitHub Desktop.
Save ckeyer/79086baee7589a754545 to your computer and use it in GitHub Desktop.
跨域访问WebApi服务器是出现 No 'Access-Control-Allow-Origin' 的问题
package controllers
import (
"github.com/astaxie/beego"
)
type Controller struct {
beego.Controller
}
func (this *Controller) Prepare() {
this.Ctx.ResponseWriter.Header().Add("Access-Control-Allow-Origin", "*")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment