fix #14 https on localhost

This commit is contained in:
Matt Walsh 2022-11-14 13:40:38 -06:00
parent 95b135a9b7
commit 6e70ccb252

View file

@ -177,8 +177,8 @@ const utils = (() => {
let corsUrl = _url; let corsUrl = _url;
if (params.cors === true) corsUrl = rewriteUrl(_url); if (params.cors === true) corsUrl = rewriteUrl(_url);
const url = new URL(corsUrl, `${window.location.origin}/`); const url = new URL(corsUrl, `${window.location.origin}/`);
// match the security protocol // match the security protocol when not on localhost
url.protocol = window.location.protocol; url.protocol = window.location.hostname !== 'localhost' ? window.location.protocol : url.protocol;
// add parameters if necessary // add parameters if necessary
if (params.data) { if (params.data) {
Object.keys(params.data).forEach((key) => { Object.keys(params.data).forEach((key) => {