Skip to content

Commit

Permalink
fix: selfhost websocket path
Browse files Browse the repository at this point in the history
  • Loading branch information
julianpoy committed Dec 16, 2023
1 parent 25b237d commit 974cddc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/frontend/src/environments/environment.selfhost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ export const ENABLE_ANALYTICS = false;
export const STRIPE_PK = "";

export const API_BASE_URL = "api/";
export const GRIP_WS_URL = "grip/ws";

// Selfhost requires some extra sniffing to determine base url for WS since
// ws can't be "relative" via just `grip/ws` like `api/` can.
const wsProto = window.location.protocol === "https:" ? "wss:" : "ws:";
const path = window.location.pathname;
const extraSlash = path.endsWith("/") ? "" : "/";
export const GRIP_WS_URL = `${wsProto}//${window.location.host}${path}${extraSlash}grip/ws`;

export const SENTRY_SAMPLE_RATE = 0;

0 comments on commit 974cddc

Please sign in to comment.