Skip to content

Commit 363f7ef

Browse files
committed
trim prefix
1 parent 2391b35 commit 363f7ef

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
* Handles API requests by proxying them to the backend
2222
*/
2323
async function handleApiRequest(request: Request, env: Env, url: URL): Promise<Response> {
24-
const backendUrl = 'https://laclipasa-backend.fly.dev' + url.pathname + url.search;
24+
const backendUrl = 'https://laclipasa-backend.fly.dev' + url.pathname.replace('/fly-api', '') + url.search;
2525

2626
const headers = new Headers(request.headers);
2727

test/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe('Reverse Proxy Worker', () => {
7979

8080
// Check that fetch was called with the expected URL
8181
expect(mockFetchCall).not.toBeNull();
82-
expect(mockFetchCall?.url).toBe('https://laclipasa-backend.fly.dev/fly-api/users');
82+
expect(mockFetchCall?.url).toBe('https://laclipasa-backend.fly.dev/users');
8383
});
8484

8585
it('forwards request method, headers and body', async () => {

0 commit comments

Comments
 (0)