Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 3ff0cfd

Browse files
authored
Merge pull request #32 from giuseppeg/fix-protocol-handler
Handle only Remix requests on port 80
2 parents 252a9ad + 6e0a576 commit 3ff0cfd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

workspaces/remix-electron/src/index.mts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ export async function initRemix({
5555
await app.whenReady()
5656

5757
protocol.handle("http", async (request) => {
58+
const url = new URL(request.url)
59+
if (
60+
// We only want to handle local (Remix) requests to port 80.
61+
// Requests to other hosts or ports should not be intercepted,
62+
// this might be the case when an application makes requests to a local service.
63+
!["localhost", "127.0.0.1"].includes(url.hostname) ||
64+
(url.port && url.port !== "80")
65+
) {
66+
return await fetch(request)
67+
}
68+
5869
request.headers.append("Referer", request.referrer)
5970
try {
6071
const assetResponse = await serveAsset(request, publicFolder)

0 commit comments

Comments
 (0)