From 75818cf808e515c9da241285711d3086582f61e8 Mon Sep 17 00:00:00 2001 From: Vinh Date: Tue, 4 Feb 2020 20:16:36 +0100 Subject: [PATCH] Use absolute graphql url to fix ie11 bug (#2823) * fix: use absolute graphql to fix ie11 bug * fix: improved url composition --- src/core/client/framework/lib/bootstrap/createManaged.tsx | 4 ++-- src/core/client/framework/lib/network/createNetwork.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/client/framework/lib/bootstrap/createManaged.tsx b/src/core/client/framework/lib/bootstrap/createManaged.tsx index 6ab6ba7d6..9c96aadb9 100644 --- a/src/core/client/framework/lib/bootstrap/createManaged.tsx +++ b/src/core/client/framework/lib/bootstrap/createManaged.tsx @@ -56,8 +56,8 @@ interface CreateContextArguments { /** websocketURL points to our live graphql server */ const websocketURL = `${location.protocol === "https:" ? "wss" : "ws"}://${ - location.hostname -}:${location.port}/api/graphql/live`; + location.host +}/api/graphql/live`; /** * timeagoFormatter integrates timeago into our translation diff --git a/src/core/client/framework/lib/network/createNetwork.ts b/src/core/client/framework/lib/network/createNetwork.ts index 2113e7f5c..4659415dd 100644 --- a/src/core/client/framework/lib/network/createNetwork.ts +++ b/src/core/client/framework/lib/network/createNetwork.ts @@ -8,6 +8,7 @@ import { } from "react-relay-network-modern/es"; import TIME from "coral-common/time"; +import getLocationOrigin from "coral-framework/utils/getLocationOrigin"; import clientIDMiddleware from "./clientIDMiddleware"; import { ManagedSubscriptionClient } from "./createManagedSubscriptionClient"; @@ -16,7 +17,7 @@ import persistedQueriesGetMethodMiddleware from "./persistedQueriesGetMethodMidd export type TokenGetter = () => string; -const graphqlURL = "/api/graphql"; +const graphqlURL = `${getLocationOrigin()}/api/graphql`; function createSubscriptionFunction( subscriptionClient: ManagedSubscriptionClient