Skip to content

Commit

Permalink
Upgrade asset link to https in secure context
Browse files Browse the repository at this point in the history
  • Loading branch information
OmniTroid committed Nov 19, 2023
1 parent dd47194 commit d077770
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions webAO/client/aoHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit d077770

Please sign in to comment.