http head

w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With")

//允许共享
w.Header().Set("Access-Control-Allow-Credentials", "true")
//愿意共享给:http://localhost:9000
w.Header().Set("Access-Control-Allow-Origin", "http://localhost:9000")

 

Access-Control-Allow-Origin

https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/Access-Control-Allow-Origin

 

Access-Control-Allow- 设置 跨域资源共享 CORS 详解

https://blog.csdn.net/weixin_42273457/article/details/84527410

 

posted @ 2020-08-31 21:25  javalzy  阅读(114)  评论(0编辑  收藏  举报