Add CORS header to allow cross origin requests

This commit is contained in:
Simon Marsh
2019-02-23 11:13:27 +00:00
parent ddbedc0ff6
commit 79081f79d2
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -59,6 +59,7 @@ func ResponseJSON(w http.ResponseWriter, v interface{}) {
// write back to http handler
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Write(data)
}
+2
View File
@@ -138,6 +138,8 @@ func roaBirdHandler(w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Content-Type", "text/plain")
w.Header().Set("Access-Control-Allow-Origin", "*")
fmt.Fprintf(w, "#\n# dn42regsrv ROA Generator\n# Last Updated: %s\n"+
"# Commit: %s\n#\n", ROAData.CTime.String(), ROAData.Commit)