Adding checks to remove default ports from URLs when changing the scheme