From: Dessalines <tyhou13@gmx.com>
Date: Mon, 26 Apr 2021 19:32:59 +0000 (-0400)
Subject: Fix httpBase
X-Git-Url: http://these/git/%22https:/image.com/static/readmes/README.es.md?a=commitdiff_plain;h=a136d064ae0bba72479f91e8c27b242244183b44;p=lemmy-ui.git

Fix httpBase
---

diff --git a/src/server/index.tsx b/src/server/index.tsx
index 1c58ca8..2d2a662 100644
--- a/src/server/index.tsx
+++ b/src/server/index.tsx
@@ -16,7 +16,7 @@ import { GetSite, GetSiteResponse, LemmyHttp } from "lemmy-js-client";
 import process from "process";
 import { Helmet } from "inferno-helmet";
 import { initializeSite } from "../shared/initialize";
-import { httpBase } from "../shared/env";
+import { httpBaseInternal } from "../shared/env";
 import { IncomingHttpHeaders } from "http";
 import { setOptionalAuth } from "../shared/utils";
 
@@ -44,7 +44,7 @@ server.get("/*", async (req, res) => {
   let headers = setForwardedHeaders(req.headers);
 
   let initialFetchReq: InitialFetchRequest = {
-    client: new LemmyHttp(httpBase, headers),
+    client: new LemmyHttp(httpBaseInternal, headers),
     auth,
     path: req.path,
   };
diff --git a/src/shared/env.ts b/src/shared/env.ts
index 0b094ce..505b5c1 100644
--- a/src/shared/env.ts
+++ b/src/shared/env.ts
@@ -33,9 +33,10 @@ if (isBrowser()) {
   secure = process.env.LEMMY_HTTPS == "true" ? "s" : "";
 }
 
-export const httpBase = `http://${host}`; // Don't use secure here
+export const httpBaseInternal = `http://${host}`; // Don't use secure here
+export const httpBase = `http${secure}://${host}`;
 export const wsUri = `ws${secure}://${wsHost}/api/v3/ws`;
-export const pictrsUri = `http${secure}://${host}/pictrs/image`;
+export const pictrsUri = `${httpBase}/pictrs/image`;
 
 console.log(`httpbase: ${httpBase}`);
 console.log(`wsUri: ${wsUri}`);