Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions client/src/setupProxy.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = (app) => {
app.use(
createProxyMiddleware({
target: 'http://127.0.0.1:8000',
changeOrigin: true,
pathFilter: (path) =>
path.startsWith('/api') ||
path.startsWith('/static/uploads') ||
path.startsWith('/static/explain'),
})
);
const proxy = createProxyMiddleware({
target: 'http://127.0.0.1:8000',
changeOrigin: true,
});

// Filter before proxying so both v2 and v3 preserve frontend routes.
app.use((req, res, next) => {
const path = req.path;
const isBackendPath = ['/api', '/static/uploads', '/static/explain'].some(
(prefix) => path === prefix || path.startsWith(`${prefix}/`)
);
return isBackendPath ? proxy(req, res, next) : next();
});
};
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ services:
- redis

react:
image: seoyunje/deepguard-react:1.0.17
image: seoyunje/deepguard-react:1.0.18
container_name: deepguard-react
networks: [deepguard-network]
ports:
Expand Down
Loading