From faacb8b8c7be0a498c6454808a09229a2dea4ef0 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Tue, 29 Jul 2025 13:48:25 +1000 Subject: [PATCH] Fixed CORS configuration --- configure-script.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure-script.js b/configure-script.js index a950cad..a3e0ebd 100644 --- a/configure-script.js +++ b/configure-script.js @@ -53,12 +53,14 @@ See https://github.com/krgamestudios/MERN-template/wiki for help. // } // const localAddress = macUser === 'yes' ? 'localhost' : '%'; - const localAddress = '%'; + const localAddress = '%'; //project configuration const projectName = await question('Project Name', 'template'); const projectWebAddress = await question('Project Web Address', 'example.com'); + const corsWebOrigin = await question('CORS Web Origin', `https://${projectWebAddress}`); + let projectDBLocation = ''; while (typeof projectDBLocation != 'string' || /^[le]/i.test(projectDBLocation[0]) == false) { projectDBLocation = await question('Project [l]ocal or [e]xternal database?'); @@ -207,6 +209,7 @@ services: - traefik.http.routers.${projectName}router.service=${projectName}service@docker - traefik.http.services.${projectName}service.loadbalancer.server.port=${projectPort} environment: + - WEB_ORIGIN=${corsWebOrigin} - WEB_PORT=${projectPort} - DB_HOSTNAME=${projectDBHost} - DB_PORTNAME=${projectDBPort} @@ -239,6 +242,7 @@ services: - traefik.http.routers.${newsName}router.service=${newsName}service@docker - traefik.http.services.${newsName}service.loadbalancer.server.port=${newsPort} environment: + - WEB_ORIGIN=${corsWebOrigin} - WEB_PORT=${newsPort} - DB_HOSTNAME=${newsDBHost} - DB_PORTNAME=${newsDBPort} @@ -269,6 +273,7 @@ services: - traefik.http.routers.${authName}router.service=${authName}service@docker - traefik.http.services.${authName}service.loadbalancer.server.port=${authPort} environment: + - WEB_ORIGIN=${corsWebOrigin} - WEB_PROTOCOL=https - WEB_ADDRESS=${authWebAddress} - HOOK_POST_VALIDATION_ARRAY=${authPostValidationHookArray} @@ -310,6 +315,7 @@ services: - traefik.http.routers.${chatName}router.service=${chatName}service@docker - traefik.http.services.${chatName}service.loadbalancer.server.port=${chatPort} environment: + - WEB_ORIGIN=${corsWebOrigin} - WEB_PORT=${chatPort} - DB_HOSTNAME=${chatDBHost} - DB_PORTNAME=${chatDBPort}