Skip to content

Commit 7f59ce1

Browse files
committed
Fix #3295
Proxy handle JS files as well
1 parent 4ce27cf commit 7f59ce1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

redisinsight/api/src/middleware/subpath-proxy.middleware.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ export default class SubpathProxyMiddleware implements NestMiddleware {
99
const originalSendFile = res.sendFile;
1010
const proxyPath = trim(process.env.RI_PROXY_PATH, '/');
1111
res.sendFile = function (this: Response, path: string, options: any, callback?: (err?: Error) => void) {
12-
if (path.endsWith('.html')) {
12+
if (path.endsWith('.html') || path.endsWith('.js')) {
1313
let content = fs.readFileSync(path, 'utf8');
1414
const regex = /\/?__RIPROXYPATH__/g;
1515

1616
// for vite build proxyPath if exists should starts with '/'
17-
content = content.replace(regex, proxyPath ? '/'+proxyPath : '');
17+
content = content.replace(regex, proxyPath ? '/' + proxyPath : '');
1818
res.send(content);
1919
return;
2020
}

0 commit comments

Comments
 (0)