Add TO Golang CORS headers

Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/b9780d89
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/b9780d89
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/b9780d89

Branch: refs/heads/master
Commit: b9780d89e8476064afd3b98a2dd189e23e193a27
Parents: e23a617
Author: Robert Butts <robert.o.bu...@gmail.com>
Authored: Wed Jul 26 17:57:40 2017 -0600
Committer: Dewayne Richardson <dewr...@apache.org>
Committed: Thu Aug 10 09:46:03 2017 -0600

----------------------------------------------------------------------
 traffic_ops/traffic_ops_golang/wrappers.go | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b9780d89/traffic_ops/traffic_ops_golang/wrappers.go
----------------------------------------------------------------------
diff --git a/traffic_ops/traffic_ops_golang/wrappers.go 
b/traffic_ops/traffic_ops_golang/wrappers.go
index 5a5cfce..386e278 100644
--- a/traffic_ops/traffic_ops_golang/wrappers.go
+++ b/traffic_ops/traffic_ops_golang/wrappers.go
@@ -32,6 +32,9 @@ const ServerName = "traffic_ops_golang" + "/" + Version
 
 func wrapHeaders(h RegexHandlerFunc) RegexHandlerFunc {
        return func(w http.ResponseWriter, r *http.Request, p ParamMap) {
+               w.Header().Set("Access-Control-Allow-Credentials", "true")
+               w.Header().Set("Access-Control-Allow-Headers", "Origin, 
X-Requested-With, Content-Type, Accept")
+               w.Header().Set("Access-Control-Allow-Methods", 
"POST,GET,OPTIONS,PUT,DELETE")
                w.Header().Set("Access-Control-Allow-Origin", "*")
                w.Header().Set("X-Server-Name", ServerName)
                h(w, r, p)

Reply via email to