restore support for local dev using a non-local url

This commit is contained in:
Hazelnoot 2025-02-06 12:57:44 -05:00
parent eaed8f2cec
commit 0d1c993dd2
3 changed files with 2 additions and 17 deletions

View file

@ -323,19 +323,16 @@ export class ClientServerService {
done();
});
} else {
const configUrl = new URL(this.config.url);
const urlOriginWithoutPort = configUrl.origin.replace(/:\d+$/, '');
const port = (process.env.VITE_PORT ?? '5173');
fastify.register(fastifyProxy, {
upstream: urlOriginWithoutPort + ':' + port,
upstream: `http://localhost:${port}`,
prefix: '/vite',
rewritePrefix: '/vite',
});
const embedPort = (process.env.EMBED_VITE_PORT ?? '5174');
fastify.register(fastifyProxy, {
upstream: urlOriginWithoutPort + ':' + embedPort,
upstream: `http://localhost:${embedPort}`,
prefix: '/embed_vite',
rewritePrefix: '/embed_vite',
});