Skip to content

Commit

Permalink
fix intercepted bass requests
Browse files Browse the repository at this point in the history
  • Loading branch information
SapiensAnatis committed Jun 30, 2024
1 parent 99aa2f8 commit f6874df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Website/src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ if (PUBLIC_ENABLE_MSW === 'true') {
});
}

export const handleFetch: HandleFetch = ({ request, fetch }) => {
export const handleFetch: HandleFetch = ({ request, fetch, event }) => {
const requestUrl = new URL(request.url);

if (requestUrl.pathname.includes('/api')) {
if (event.url.origin === requestUrl.origin && requestUrl.pathname.startsWith('/api')) {
// Rewrite URL to internal
const newUrl = request.url.replace(requestUrl.origin, internalApiUrl.origin);
console.log(`Rewriting request: from ${requestUrl.href} to ${newUrl}`);
Expand Down

0 comments on commit f6874df

Please sign in to comment.