mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-05-05 12:22:35 +02:00
Integrated Fantastic coffie (decaffeinated) base version
This commit is contained in:
parent
2fc5535f0f
commit
94036c4831
482 changed files with 476112 additions and 0 deletions
19
cmd/webapi/cors.go
Normal file
19
cmd/webapi/cors.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/gorilla/handlers"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// applyCORSHandler applies a CORS policy to the router. CORS stands for Cross-Origin Resource Sharing: it's a security
|
||||
// feature present in web browsers that blocks JavaScript requests going across different domains if not specified in a
|
||||
// policy. This function sends the policy of this API server.
|
||||
func applyCORSHandler(h http.Handler) http.Handler {
|
||||
return handlers.CORS(
|
||||
handlers.AllowedHeaders([]string{
|
||||
"x-example-header",
|
||||
}),
|
||||
handlers.AllowedMethods([]string{"GET", "POST", "OPTIONS", "DELETE", "PUT"}),
|
||||
handlers.AllowedOrigins([]string{"*"}),
|
||||
)(h)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue