Use current host as fallback for FS_HOSTNAME

This commit is contained in:
Zaid Abdulla committed 2019-06-05 00:17:36 -07:00
1 parent 7154d2cc7e
commit 7fdcb57e1d
3 files changed
+9 -4

No files matched your search

+1 -1
View File
@@ -62,7 +62,7 @@ const options = {
FS_INTERFACE: { type: "string", default: "0.0.0.0" },
FS_SSL_CERT: { type: "string", default: "" },
FS_SSL_KEY: { type: "string", default: "" },
FS_HOSTNAME: { type: "string", default: "acs.example.com" },
FS_HOSTNAME: { type: "string", default: "" },
FS_LOG_FILE: { type: "path", default: "" },
FS_ACCESS_LOG_FILE: { type: "path", default: "" },
+7 -2
View File
@@ -772,10 +772,15 @@ async function sendAcsRequest(
downloadRequest.fileSize = 0;
if (!downloadRequest.url) {
const FS_PORT = config.get("FS_PORT");
const FS_HOSTNAME = config.get("FS_HOSTNAME");
const FS_SSL = config.get("FS_SSL");
let hostname = config.get("FS_HOSTNAME");
if (!hostname) {
if (sessionContext.httpRequest.headers["host"])
hostname = sessionContext.httpRequest.headers["host"].split(":")[0];
else hostname = sessionContext.httpRequest.connection.localAddress;
}
downloadRequest.url = FS_SSL ? "https://" : "http://";
downloadRequest.url += FS_HOSTNAME;
downloadRequest.url += hostname;
if (FS_PORT !== 80) downloadRequest.url += ":" + FS_PORT;
downloadRequest.url += "/" + encodeURI(downloadRequest.fileName);