Same issue for me. My workaround was
if (window.location.origin == localhost) use localhost; else use live server