Configure CORS
This commit is contained in:
parent
ee824da6e0
commit
f6920046a8
2 changed files with 8 additions and 1 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.zip
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue