This commit is contained in:
teddy
2025-05-08 16:57:25 +07:00
parent d0386a7de4
commit 8924636b53

View File

@@ -14,7 +14,7 @@ import (
func corsMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*") // Ganti * dengan origin spesifik jika perlu
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, FETCH")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
// Untuk preflight request