From 212832fdda174e7032e00c8c19d37bfea5f10660 Mon Sep 17 00:00:00 2001 From: Nurfog Date: Tue, 31 Mar 2026 12:55:12 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20A=C3=B1adir=20l=C3=B3gica=20condicional?= =?UTF-8?q?=20para=20la=20URL=20de=20la=20API=20CMS=20y=20mejorar=20la=20c?= =?UTF-8?q?onfiguraci=C3=B3n=20de=20Nginx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/learning.conf | 11 +++++++++++ web/experience/src/lib/api.ts | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/nginx/learning.conf b/nginx/learning.conf index 391991e..0e184e2 100644 --- a/nginx/learning.conf +++ b/nginx/learning.conf @@ -11,3 +11,14 @@ location /lms-api/ { proxy_set_header Connection ""; proxy_http_version 1.1; } + +location /cms-api/ { + rewrite ^/cms-api/(.*)$ /$1 break; + proxy_pass http://openccb-studio:3001; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto; + proxy_set_header Connection ""; + proxy_http_version 1.1; +} diff --git a/web/experience/src/lib/api.ts b/web/experience/src/lib/api.ts index e25a770..ecf45b4 100644 --- a/web/experience/src/lib/api.ts +++ b/web/experience/src/lib/api.ts @@ -16,7 +16,12 @@ export const getLmsApiUrl = () => { } return getApiBaseUrl("3002", process.env.NEXT_PUBLIC_LMS_API_URL); }; -export const getCmsApiUrl = () => getApiBaseUrl("3001", process.env.NEXT_PUBLIC_CMS_API_URL); +export const getCmsApiUrl = () => { + if (typeof window !== 'undefined' && window.location.hostname === 'learning.norteamericano.com') { + return `${window.location.protocol}//learning.norteamericano.com/cms-api`; + } + return getApiBaseUrl("3001", process.env.NEXT_PUBLIC_CMS_API_URL); +}; export const getImageUrl = (path?: string) => { if (!path) return '';