Skip to content

Commit

Permalink
Merge pull request #181 from konecty/fix/allways-proxy-path
Browse files Browse the repository at this point in the history
fix: always proxy ui path
  • Loading branch information
7sete7 authored Oct 21, 2024
2 parents 9d43e67 + bb6f88c commit 93f0db1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,20 @@ if (process.env.UI_PROXY === 'true') {
});
} else {
fastify.register(viewPaths);
if (process.env.UI_PROXY_PATH) {
fastify.register(proxy, {
upstream: process.env.UI_PROXY_URL ?? 'http://localhost:3000',
httpMethods: ['GET', 'HEAD'],
prefix: `${process.env.UI_PROXY_PATH}:path`,
rewritePrefix: ':path',
replyOptions: {
onResponse: (request, reply) => {
const proxyUrl = `${process.env.UI_PROXY_URL}${request.url?.replace('/ui', '')}`;
reply.from(proxyUrl);
},
}
if (process.env.UI_PROXY_PATH && process.env.UI_PROXY_URL) {
fastify.register(proxy, {
upstream: process.env.UI_PROXY_URL,
httpMethods: ['GET', 'HEAD'],
prefix: `${process.env.UI_PROXY_PATH}:path`,
rewritePrefix: ':path',
replyOptions: {
onResponse: (request, reply) => {
const proxyUrl = `${process.env.UI_PROXY_URL}${request.url?.replace('/ui', '')}`;
reply.from(proxyUrl);
},
});
}
},
});
}
fastify.register(healthApi);

Expand Down

0 comments on commit 93f0db1

Please sign in to comment.