add multiple cors url

b2
Subhodip Ghosh 2025-06-23 16:47:40 +05:30
parent e03e883e3a
commit 5b88db84ae
1 changed files with 6 additions and 2 deletions

View File

@ -113,11 +113,15 @@ func saveImageNames() {
func serveAPI() { func serveAPI() {
// Create a new CORS handler // Create a new CORS handler
c := cors.New(cors.Options{ c := cors.New(cors.Options{
AllowedOrigins: []string{"http://localhost:4321"}, // Your frontend origin AllowedOrigins: []string{
"http://localhost:4321",
"https://siliconpin.cs1.hz.siliconpin.com",
"https://siliconpin.com",
},
AllowedMethods: []string{"GET", "POST", "OPTIONS"}, AllowedMethods: []string{"GET", "POST", "OPTIONS"},
AllowedHeaders: []string{"Content-Type"}, AllowedHeaders: []string{"Content-Type"},
AllowCredentials: true, AllowCredentials: true,
Debug: true, // Remove in production // Debug: true, // Remove in production
}) })
// Create a new mux router // Create a new mux router