Safari: bypass "this connection is not private" doesn't work for access through IP address?

Solution 1:

The bypass can't be bypassed apparently. Note also that it may fail and keep requesting authentication if your hosts file entry has both short and FQDN specified. In that case you MUST use the FQDN. This is possibly because the Mac will append your local domain to any unqualified host names before checking for permission and (I am guessing) that a remote site identifying as your local machine domain (mymac.local for example) can't be added to the keychain. OR it might be that having ONLY a short host name in /etc/hosts would be OK but if you have BOTH long and short names specified then you must use the FQDN as that is the one that resolves in your host file.

Solution 2:

Well the only solution I have found for that issue is to serve the website in safari private mode.
Than safari still complain that the connecton is not private but you can hit "deatils" and than "open website".
With this workaround its not needed to edit /etc/hosts