Fixed CORS configuration

This commit is contained in:
2025-07-29 13:48:25 +10:00
parent c48fcba994
commit faacb8b8c7
+7 -1
View File
@@ -53,12 +53,14 @@ See https://github.com/krgamestudios/MERN-template/wiki for help.
// } // }
// const localAddress = macUser === 'yes' ? 'localhost' : '%'; // const localAddress = macUser === 'yes' ? 'localhost' : '%';
const localAddress = '%'; const localAddress = '%';
//project configuration //project configuration
const projectName = await question('Project Name', 'template'); const projectName = await question('Project Name', 'template');
const projectWebAddress = await question('Project Web Address', 'example.com'); const projectWebAddress = await question('Project Web Address', 'example.com');
const corsWebOrigin = await question('CORS Web Origin', `https://${projectWebAddress}`);
let projectDBLocation = ''; let projectDBLocation = '';
while (typeof projectDBLocation != 'string' || /^[le]/i.test(projectDBLocation[0]) == false) { while (typeof projectDBLocation != 'string' || /^[le]/i.test(projectDBLocation[0]) == false) {
projectDBLocation = await question('Project [l]ocal or [e]xternal database?'); 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.routers.${projectName}router.service=${projectName}service@docker
- traefik.http.services.${projectName}service.loadbalancer.server.port=${projectPort} - traefik.http.services.${projectName}service.loadbalancer.server.port=${projectPort}
environment: environment:
- WEB_ORIGIN=${corsWebOrigin}
- WEB_PORT=${projectPort} - WEB_PORT=${projectPort}
- DB_HOSTNAME=${projectDBHost} - DB_HOSTNAME=${projectDBHost}
- DB_PORTNAME=${projectDBPort} - DB_PORTNAME=${projectDBPort}
@@ -239,6 +242,7 @@ services:
- traefik.http.routers.${newsName}router.service=${newsName}service@docker - traefik.http.routers.${newsName}router.service=${newsName}service@docker
- traefik.http.services.${newsName}service.loadbalancer.server.port=${newsPort} - traefik.http.services.${newsName}service.loadbalancer.server.port=${newsPort}
environment: environment:
- WEB_ORIGIN=${corsWebOrigin}
- WEB_PORT=${newsPort} - WEB_PORT=${newsPort}
- DB_HOSTNAME=${newsDBHost} - DB_HOSTNAME=${newsDBHost}
- DB_PORTNAME=${newsDBPort} - DB_PORTNAME=${newsDBPort}
@@ -269,6 +273,7 @@ services:
- traefik.http.routers.${authName}router.service=${authName}service@docker - traefik.http.routers.${authName}router.service=${authName}service@docker
- traefik.http.services.${authName}service.loadbalancer.server.port=${authPort} - traefik.http.services.${authName}service.loadbalancer.server.port=${authPort}
environment: environment:
- WEB_ORIGIN=${corsWebOrigin}
- WEB_PROTOCOL=https - WEB_PROTOCOL=https
- WEB_ADDRESS=${authWebAddress} - WEB_ADDRESS=${authWebAddress}
- HOOK_POST_VALIDATION_ARRAY=${authPostValidationHookArray} - HOOK_POST_VALIDATION_ARRAY=${authPostValidationHookArray}
@@ -310,6 +315,7 @@ services:
- traefik.http.routers.${chatName}router.service=${chatName}service@docker - traefik.http.routers.${chatName}router.service=${chatName}service@docker
- traefik.http.services.${chatName}service.loadbalancer.server.port=${chatPort} - traefik.http.services.${chatName}service.loadbalancer.server.port=${chatPort}
environment: environment:
- WEB_ORIGIN=${corsWebOrigin}
- WEB_PORT=${chatPort} - WEB_PORT=${chatPort}
- DB_HOSTNAME=${chatDBHost} - DB_HOSTNAME=${chatDBHost}
- DB_PORTNAME=${chatDBPort} - DB_PORTNAME=${chatDBPort}