diff --git a/src/ui/lib/database-transfer-url.ts b/src/ui/lib/database-transfer-url.ts index e0f3c5fd..c7394bd3 100644 --- a/src/ui/lib/database-transfer-url.ts +++ b/src/ui/lib/database-transfer-url.ts @@ -20,10 +20,7 @@ export function getDatabaseTransferUrl( return `${serverUrl.replace(/\/$/, "")}/database/${operation}`; } - const development = - location.port === "5173" || - location.hostname === "localhost" || - location.hostname === "127.0.0.1"; + const development = location.port === "5173"; if (development) { return `http://localhost:30001/database/${operation}`; diff --git a/src/ui/tests/lib/database-transfer-url.test.ts b/src/ui/tests/lib/database-transfer-url.test.ts index 62339877..1316240b 100644 --- a/src/ui/tests/lib/database-transfer-url.test.ts +++ b/src/ui/tests/lib/database-transfer-url.test.ts @@ -51,4 +51,21 @@ describe("getDatabaseTransferUrl", () => { }), ).toBe("http://localhost:30001/database/export"); }); + + it.each(["localhost", "127.0.0.1"])( + "keeps Docker access through %s on the browser origin", + (hostname) => { + expect( + getDatabaseTransferUrl("export", { + electron: false, + location: { + protocol: "http:", + host: `${hostname}:8080`, + hostname, + port: "8080", + }, + }), + ).toBe(`http://${hostname}:8080/database/export`); + }, + ); });