Skip to content

Commit d9e0e0e

Browse files
authored
Merge pull request #3502 from RedisInsight/bugfix/3295-proxy-handle-js-files
Handle JS files in the subpath proxy
2 parents c55fd92 + 7f59ce1 commit d9e0e0e

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)