diff options
Diffstat (limited to 'webAO/client/aoHost.ts')
| -rw-r--r-- | webAO/client/aoHost.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/webAO/client/aoHost.ts b/webAO/client/aoHost.ts index 6cad62a..33e010d 100644 --- a/webAO/client/aoHost.ts +++ b/webAO/client/aoHost.ts @@ -3,5 +3,14 @@ import queryParser from '../utils/queryParser' const { asset } = queryParser(); export let AO_HOST = asset; export const setAOhost = (val: string) => { + const currentProtocol = window.location.protocol; + const assetProtocol = val.split(':')[0] + ':'; + + if (currentProtocol === 'https:' && assetProtocol === 'http:') { + // In this specific case, we need to request assets over HTTPS + console.log('Upgrading asset link to https'); + val = val.replace('http:', 'https:'); + } + AO_HOST = val; } |
