summaryrefslogtreecommitdiff
path: root/server/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'server/cmd')
-rw-r--r--server/cmd/main.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/server/cmd/main.go b/server/cmd/main.go
index f9da6ce..7b2310a 100644
--- a/server/cmd/main.go
+++ b/server/cmd/main.go
@@ -52,7 +52,7 @@ func serveHTTP(handler http.Handler) http.Handler {
}
func writeMethods(responseWriter http.ResponseWriter, request *http.Request) {
- allowedMethods := []string{"OPTIONS", "POST", "PUT"}
+ allowedMethods := []string{"OPTIONS", "POST", "PUT", "GET", "DELETE"}
method := request.Header.Get("Access-Control-Request-Method")
if isPreflight(request) && slices.Contains(allowedMethods, method) {
responseWriter.Header().Add("Access-Control-Allow-Methods", method)
@@ -60,9 +60,8 @@ func writeMethods(responseWriter http.ResponseWriter, request *http.Request) {
}
func writeOrigins(responseWriter http.ResponseWriter, request *http.Request) {
- allowedOrigins := []string{"http://localhost:5173"}
origin := request.Header.Get("Origin")
- if slices.Contains(allowedOrigins, origin) {
+ if origin == "http://localhost:5173" {
responseWriter.Header().Add("Access-Control-Allow-Origin", origin)
}
}