1
mirror of https://git.burble.com/burble.dn42/dn42regsrv.git synced 2024-02-26 20:28:04 +01:00

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
No known key found for this signature in database
GPG Key ID: 7B9FE8780CFB6593
2 changed files with 3 additions and 0 deletions

View File

@ -59,6 +59,7 @@ func ResponseJSON(w http.ResponseWriter, v interface{}) {
// write back to http handler // write back to http handler
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Write(data) w.Write(data)
} }

View File

@ -138,6 +138,8 @@ func roaBirdHandler(w http.ResponseWriter, r *http.Request) {
} }
w.Header().Set("Content-Type", "text/plain") 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"+ fmt.Fprintf(w, "#\n# dn42regsrv ROA Generator\n# Last Updated: %s\n"+
"# Commit: %s\n#\n", ROAData.CTime.String(), ROAData.Commit) "# Commit: %s\n#\n", ROAData.CTime.String(), ROAData.Commit)