diff --git a/packages/server/src/controllers/FilesController/index.js b/packages/server/src/controllers/FilesController/index.js index 4c63ab35..6813c600 100644 --- a/packages/server/src/controllers/FilesController/index.js +++ b/packages/server/src/controllers/FilesController/index.js @@ -7,7 +7,7 @@ import pmap from "../../utils/pMap" const formidable = require("formidable") export function resolveToUrl(filepath, req) { - const host = req ? (req.protocol + "://" + req.get("host")) : global.globalPublicURI + const host = req ? (req.protocol + "://" + req.get("host")) : global.globalPublicUri return `${host}/storage/${filepath}` } diff --git a/packages/server/src/index.js b/packages/server/src/index.js index 31e43d21..08580f73 100644 --- a/packages/server/src/index.js +++ b/packages/server/src/index.js @@ -89,7 +89,10 @@ class Server { global.wsInterface = this.httpInstance.wsInterface global.httpListenPort = this.listenPort - global.globalPublicURI = this.env.globalPublicURI + + global.publicHostname = this.env.publicHostname + global.publicProtocol = this.env.publicProtocol + global.globalPublicUri = `${this.env.publicProtocol}://${this.env.publicHost}` global.uploadPath = this.env.uploadPath ?? path.resolve(process.cwd(), "uploads") global.uploadCachePath = this.env.uploadCachePath ?? path.resolve(process.cwd(), "cache")