Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created September 25, 2022 15:04
Show Gist options
  • Save percybolmer/fa27e294438534e5992c4d0b29d70aae to your computer and use it in GitHub Desktop.
Save percybolmer/fa27e294438534e5992c4d0b29d70aae to your computer and use it in GitHub Desktop.
// checkOrigin will check origin and return true if its allowed
func checkOrigin(r *http.Request) bool {
// Grab the request origin
origin := r.Header.Get("Origin")
switch origin {
// Update this to HTTPS
case "https://localhost:8080":
return true
default:
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment