From 8d86fe710d083e1d5b2f031ddcf3443b044785e3 Mon Sep 17 00:00:00 2001 From: burnettk Date: Mon, 17 Oct 2022 17:18:24 -0400 Subject: [PATCH] Squashed 'spiffworkflow-frontend/' changes from d68d521d7..790d267b9 790d267b9 support calling backend with a domain name w/ burnettk git-subtree-dir: spiffworkflow-frontend git-subtree-split: 790d267b9ec1c757c5a5170eac965b23619f52c8 --- src/config.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/config.tsx b/src/config.tsx index 3687b9f48..94519ba80 100644 --- a/src/config.tsx +++ b/src/config.tsx @@ -1,7 +1,11 @@ const host = window.location.hostname; -export const HOST_AND_PORT = `${host}:7000`; - -export const BACKEND_BASE_URL = `http://${HOST_AND_PORT}/v1.0`; +let hostAndPort = `api.${host}`; +let protocol = 'https'; +if (/^\d+\./.test(host) || host === 'localhost') { + hostAndPort = `${host}:7000`; + protocol = 'http'; +} +export const BACKEND_BASE_URL = `${protocol}://${hostAndPort}/v1.0`; export const PROCESS_STATUSES = [ 'not_started',