From 7fb4eefabcd033d2abc370d378d7fa021989a9f1 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Tue, 23 Sep 2025 20:18:04 -0700 Subject: [PATCH] It now loads again! --- Dockerfile | 2 +- client/package.json | 1 - client/src/{setupProxy.ts => setupProxy.js} | 13 ++++++++++--- docker-compose.yml | 3 +++ 4 files changed, 14 insertions(+), 5 deletions(-) rename client/src/{setupProxy.ts => setupProxy.js} (55%) diff --git a/Dockerfile b/Dockerfile index a847951..fc0b8c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ RUN npm run build COPY client /client WORKDIR /client ENV PUBLIC_URL="/ketr.ketran" -ENV REACT_APP_API_BASE="/ketr.ketran" +ENV REACT_APP_API_BASE="" # prefer npm ci when lockfile present, otherwise fall back to npm install RUN rm -f package-lock.json RUN npm install --legacy-peer-deps --no-audit --no-fund diff --git a/client/package.json b/client/package.json index 554a6ba..72a0be2 100644 --- a/client/package.json +++ b/client/package.json @@ -2,7 +2,6 @@ "name": "peddlers-client", "version": "1.0.0", "private": true, - "proxy": "http://peddlers-server:8930", "dependencies": { "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", diff --git a/client/src/setupProxy.ts b/client/src/setupProxy.js similarity index 55% rename from client/src/setupProxy.ts rename to client/src/setupProxy.js index 5f937b1..e1c108f 100644 --- a/client/src/setupProxy.ts +++ b/client/src/setupProxy.js @@ -1,13 +1,20 @@ /* eslint-disable @typescript-eslint/no-var-requires, no-undef, @typescript-eslint/no-explicit-any */ const { createProxyMiddleware } = require('http-proxy-middleware'); -module.exports = function(app: any) { +module.exports = function(app) { const base = process.env.PUBLIC_URL; console.log(`http-proxy-middleware ${base}`); app.use(createProxyMiddleware( `${base}/api/v1/games/ws`, { ws: true, - target: 'http://localhost:8930', + target: 'http://peddlers-server:8930', changeOrigin: true, + pathRewrite: { [`^${base}`]: '' }, })); -}; \ No newline at end of file + app.use(createProxyMiddleware( + `${base}/api`, { + target: 'http://peddlers-server:8930', + changeOrigin: true, + pathRewrite: { [`^${base}`]: '' }, + })); +}; diff --git a/docker-compose.yml b/docker-compose.yml index 696d633..3635827 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,6 +45,9 @@ services: - BROWSER=none - HTTPS=true - HOST=0.0.0.0 + - WDS_SOCKET_HOST=0.0.0.0 + - WDS_SOCKET_PORT=0 + - REACT_APP_API_BASE=/ketr.ketran command: ["bash", "-c", "cd /client && npm install --legacy-peer-deps --silent --no-audit --no-fund && npm start"] networks: - peddlers-network