HeaderUtil::setCookie method skips domain parameter if IP address detected

Cookies were failing in our local dev set up due to the domain being set improperly, this change addresses these corner cases while maintaining the original functionality.