Use url.netloc instead of url.hostname to support ports for CORS

Add support for hostnames with different ports by using url.netloc instead of url.hostname to be able to differentiate multiple servers running in localhost for example.