From 1261adf0928884920e19f4220cbad0b0322ab502 Mon Sep 17 00:00:00 2001 From: Chris Seto Date: Tue, 14 Jul 2015 14:42:20 -0400 Subject: [PATCH] Add CORs headers --- fakecas.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fakecas.go b/fakecas.go index 0e34853..72f41f6 100644 --- a/fakecas.go +++ b/fakecas.go @@ -70,6 +70,7 @@ func main() { } func login(w http.ResponseWriter, r *http.Request) { + w.Header().Add("Access-Control-Allow-Origin", "*") redir, err := url.Parse(r.FormValue("service")) if err != nil { @@ -85,11 +86,13 @@ func login(w http.ResponseWriter, r *http.Request) { } func logout(w http.ResponseWriter, r *http.Request) { + w.Header().Add("Access-Control-Allow-Origin", "*") fmt.Println("Logging out and redirecting to", r.FormValue("service")) http.Redirect(w, r, r.FormValue("service"), http.StatusFound) } func serviceValidate(w http.ResponseWriter, r *http.Request) { + w.Header().Add("Access-Control-Allow-Origin", "*") session, err := mgo.Dial(*databaseaddress) if err != nil { @@ -129,6 +132,7 @@ func serviceValidate(w http.ResponseWriter, r *http.Request) { } func oauth(w http.ResponseWriter, r *http.Request) { + w.Header().Add("Access-Control-Allow-Origin", "*") session, err := mgo.Dial(*databaseaddress) if err != nil {