I always have local.my company.com DNS that resolves to 127.0.0.1. I can get a valid cert that way too.
Which I find to be a very practical solution for connecting to localhost over https, it frees you from having to install a self-signed certificates/CAs on your machine.
https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016...