Use window.location.origin to avoid hard-coding development urls