1

Closed

Bug with determining hostname from URL

description

Hi,

I noticed there is a small bug in your code to determine the hostname from an URL. You first replace the protocol scheme (https:// and http://) and next remove all forward slashes. For 'deep' URL's with subsites (i.e. https://hostname/sites/sales) this results in hostnames like this: <hostname>.sitessales

Suggested solution:

Instead of :
$hostname = $url -replace "/",""
use:
$hostname = $url.split('/')[0]
Even better (imho) would be to use a function that returns the hostname based on certain logic, because the logic to determine the hostname is used twice in the application (Add-HostsEntry and in Disable-LoopbackCheck).
Closed Dec 16, 2015 at 3:01 PM by Luigilink
Thanks you so much for this advice.
Fix Implemented in 2.1.1 release

comments