Originally @danheberden wanted to use location.origin but it didn't work for some reason, that's why we had the crazy string concatenation. Suffice it to say, this has been thought through and the current solution is effective and reliable.