function doConfig() {
    if (window.location.hostname === 'localhost') {
        mcglobals.apihost = window.location.protocol + '//localhost:5002';
    } else {
        mcglobals.apihost = window.location.protocol + '//' + window.location.hostname + '/api';
    }
}

@@ -243,16 +243,45 @@
 stname +
+ ':' + window.location.port +
  '/api';

Support website on port other than 80.