Add detect_base_url config

This diff adds the detect_base_url config, controlled by the
DETECT_BASE_URL env variable. When set to true, the BASE_URL setting is
ignored, and the base_url is derived from the request protocol and host
header.

Test Plan: Started up a local instance in my homelab, running docker
node:15 image with a nginx reverse proxy. Configured nginx to use the
same backend with multiple hostnames on https. Opened in browser and
confirmed og:url meta tag uses correct url.
This commit is contained in:
Cullen Walsh 2021-05-05 21:15:02 -07:00
parent 385ac595b9
commit 02e8cb264f
3 changed files with 29 additions and 8 deletions

View file

@ -23,6 +23,7 @@ module.exports = async function(req) {
if (config.survey_url) {
prefs.surveyUrl = config.survey_url;
}
const baseUrl = config.deriveBaseUrl(req);
return {
archive: {
numFiles: 0
@ -33,7 +34,7 @@ module.exports = async function(req) {
title: 'Send',
description:
'Encrypt and send files with a link that automatically expires to ensure your important documents dont stay online forever.',
baseUrl: config.base_url,
baseUrl,
ui: {},
storage: {
files: []