Allow port to be set as null. If null, it's omitted from baseUrl.