Fixes an issue where SSL requests can produce an invalid URL