Chrome 63 vs. dev domains
With the recent update to version 63 for Chrome they introduced a feature, that redirects all *.dev calls from HTTP to HTTPS.
If you are using *.dev domains to access your development machine, this behaviour is probably not what you want for all your local urls.
Configuring dnsmasq
At netz98 we are using dnsmasq to redirect all *.dev calls to our localhost.
dnsmasq has a setting where you can easily change this to another domain like *.localhost .
First of locate the config file for dnsmasq. If you have installed it using brew you will probably find it under /usr/local/etc/dnsmasq.conf .
Open the file in an editor of your choice and look for the following line:
address=/dev/127.0.0.1
And change it to:
address=/localhost/127.0.0.1
If you cannot find a line setting the address like shown above, just add a new line with the setting.
To restart dnsmasq you can use
brew services restart dnsmasq
Configuring apache / nginx
Depending on your choice of setup you might be using an nginx or apache setup.
You most likely have some virtual-hosts or server settings that might need to be adjusted to the new domain.
This could look something like this for nginx.
server { listen 80; server_name shop.dev; // .... }
Locate the server_name setting and any other occurences of your *.dev domain and change it to .localhost
Do not forget to change your Magento1 or Magento2 Urls in the core_config_data table.
MacOS Nameserver
For Firefox and Safari and a working ping foo.bar.localhost , you also have to add a setting for that.
Create the file /etc/resolver/localhost with the following content:
nameserver 127.0.0.1
After doing so, you need to restart the DNS Resolver and flush caches.
I am on the latest MacOS 10.13 so I had to run the following command:
sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelper; sudo dscacheutil -flushcache
If you are running a different MacOS version, you can find a great blog post over at Dreamhost where they list the commands for each MacOS version: https://help.dreamhost.com/hc/en-us/articles/214981288-Flushing-your-DNS-cache-in-Mac-OS-X-and-Linux
UPDATE:
You might have to do a reboot of your machine so that the resolver works.
UPDATE 2:
Firefox and Safari require the above mentioned resolver to work.
If you got anything to add or there even is a better solution feel free to leave a comment below.
Magento1 since 2008 / Magento2 since 2015
Passionate Road Bike Rider (~3.500km/yr)
Loves building software with a elaborate architecture and design
3x Magento Certified
Software Developer >10 years
Head of Magento Development @ netz98