So you might have set up dnsmasq with this tutorial but then you notice that you can't set cookies to subdomains of localhost or for all of localhost's subdomains (see why).
So we set up a custom "localhost", that I'll call local.host
, but you can pick whatever you want, as long as it contains
at least one dot. Just adapt the first two commands.
$ # add to hosts list
$ sudo echo "127.0.0.1 local.host" >> /private/etc/hosts
$ # tell your dns server about it
$ echo "address=/local.host/127.0.0.1" >> /usr/local/etc/dnsmasq.conf
$ # restart your dns server
$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
Now when you want to access local.host
, in most browsers you have to prepend http://
otherwise they go search for it with
your default search provider :(
So: http://local.host/
and you can set cookies on subdomains (like my.super.shiny.local.host
) as you please :)