tsk-10: CORS support (#28)

Closes #10

Reviewed-on: phoenix/textsender-auth#28
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2025-12-21 00:28:08 +00:00
committed by phoenix
parent 223b7919f9
commit 636b0280c7
5 changed files with 27 additions and 6 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ func main() {
// Configure CORS
router.Use(cors.Handler(cors.Options{
AllowedOrigins: []string{fmt.Sprintf("http://localhost:%s", config.Port), "http://localhost:5173", "https://textsender.com"},
AllowedOrigins: cfg.AllowedOrigins,
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
ExposedHeaders: []string{"Link", "X-Total-Count"},