You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cors.go
    path of file: ./repos/photoprism/pkg/header
    
    the code of the file until where you have to start completion: package header

import (
	"net/http"
	"strings"
)

// Cross-Origin Resource Sharing (CORS) headers.
const (
	AccessControlAllowOrigin  = "Access-Control-Allow-Origin"  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Contro
    
func AllowCORS(path string) bool {
	// Return false if path is empty.
	if path == "" {
		return false
	}

	// Extract extension from path.
	var ext string
	l := len(path) - 1
	for i := l; i >= 0 && path[i] != '/'; i-- {
		if path[i] == '.' {
			ext = path[i:]
			if l-len(ext) < 0 {
				// Return false if there is no filename.
				return false
			} else if r := path[i-1]; (r < '0' || r > '9') && (r < 'A' || r > 'Z') && (r < 'a' || r > 'z') {
				// Return false if the filename is invalid.
				return false
			}
			break
		}
	}

	// Return false if path does not include an extension.
	if ext == "" {
		return false
	}

	// Check list of allowed extensions.
	return CorsExt[ext]
}