From 939cc8e08ca07ff22e0fada0b8786544fada45b6 Mon Sep 17 00:00:00 2001 From: josedario87 Date: Thu, 4 Dec 2025 16:42:05 -0600 Subject: [PATCH] Feat: Agregar CORS para endpoints de API externa MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Configura headers CORS en nuxt.config.ts para permitir llamadas desde otros orĂ­genes a: - /api/messages/send - /api/mcp Esto permite que aplicaciones externas como el sistema de asistencia puedan enviar mensajes de WhatsApp. --- nuxt.config.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nuxt.config.ts b/nuxt.config.ts index fca6c3a..8425bc2 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -48,6 +48,23 @@ export default defineNuxtConfig({ openAPI: true }, routeRules: { + // CORS para API externa + '/api/messages/send': { + cors: true, + headers: { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', + 'Access-Control-Allow-Headers': 'Content-Type, Authorization' + } + }, + '/api/mcp': { + cors: true, + headers: { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', + 'Access-Control-Allow-Headers': 'Content-Type, Authorization' + } + }, '/manifest.webmanifest': { headers: { 'Content-Type': 'application/manifest+json',