mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-14 03:01:48 +00:00
Only send Access-Control-Allow-Origin: in response to a CORS request.
This saves a bit of bandwidth. NFC otherwise.
This commit is contained in:
@@ -53,8 +53,10 @@ func getPage(w http.ResponseWriter, r *http.Request) error {
|
||||
}
|
||||
}
|
||||
|
||||
// allow JavaScript code to access responses (including errors) even across origins
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
if r.Header.Get("Origin") != "" {
|
||||
// allow JavaScript code to access responses (including errors) even across origins
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
}
|
||||
|
||||
if sitePath == ".git-pages" {
|
||||
// metadata directory name shouldn't be served even if present in site manifest
|
||||
|
||||
Reference in New Issue
Block a user