diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4c4ffc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.zip diff --git a/cloudfn.go b/cloudfn.go index 75534f1..489ebc5 100644 --- a/cloudfn.go +++ b/cloudfn.go @@ -52,7 +52,13 @@ func init() { if err := initializeDB(ctx, bucketName, objectName); err != nil { panic(err) } - var corsHandler = cors.Default() + corsHandler := cors.New(cors.Options{ + AllowedOrigins: []string{"*"}, + AllowedHeaders: []string{"*"}, + AllowedMethods: []string{http.MethodPost}, + AllowCredentials: false, + MaxAge: 3600, + }) log.Println("Registering HTTP function with the Functions Framework") functions.HTTP("WordSearch", func(w http.ResponseWriter, r *http.Request) { corsHandler.ServeHTTP(w, r, handleFormSubmission)