Set Access-Control-Allow-Origin header to load external CSS

With Chrome 70, I didn’t get the bootstrap CSS files anymore.
This commit is contained in:
Michael Stapelberg 2018-12-26 16:15:14 +01:00
parent 2216841c80
commit 25dc781a8e

View File

@ -100,6 +100,8 @@ func initStatus(services []*service) {
} }
}) })
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
token := xsrfTokenFromCookies(r.Cookies()) token := xsrfTokenFromCookies(r.Cookies())
if token == 0 { if token == 0 {
// Only generate a new XSRF token if the old one is expired, so that // Only generate a new XSRF token if the old one is expired, so that
@ -140,6 +142,8 @@ func initStatus(services []*service) {
}) })
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
var st unix.Statfs_t var st unix.Statfs_t
if err := unix.Statfs("/perm", &st); err != nil { if err := unix.Statfs("/perm", &st); err != nil {
log.Printf("could not stat /perm: %v", err) log.Printf("could not stat /perm: %v", err)