Skip to content

Commit

Permalink
fix: allow proxy url and fix rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusdemoura committed Oct 16, 2024
1 parent 2140a49 commit 4f389ff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ if (process.env.UI_PROXY === 'true') {
if (process.env.UI_PROXY_PATH) {
fastify.register(proxy, {
upstream: process.env.UI_PROXY_URL ?? 'http://localhost:3000',
httpMethods: ['GET'],
httpMethods: ['GET', 'HEAD'],
prefix: process.env.UI_PROXY_PATH,
rewritePrefix: process.env.UI_PROXY_PATH,
rewritePrefix: '',
});
}
}
Expand All @@ -102,6 +102,9 @@ export async function serverStart() {

function getCorsConfig() {
const ALLOWED_ORIGINS = (process.env.ALLOWED_ORIGINS || '').split('|');
if (process.env.UI_PROXY_URL) {
ALLOWED_ORIGINS.push(process.env.UI_PROXY_URL);
}
const corsOptions: FastifyCorsOptions = {
origin: function (origin, callback) {
if (origin) {
Expand Down

0 comments on commit 4f389ff

Please sign in to comment.