loading...

DNS lookup for local IP

sorskoot profile image π“’π“Έπ“»π“Όπ“΄π“Έπ“Έπ“½πŸŒ· ・2 min read

Sometimes when testing you want to have easy access to your machine. For example, when building and testing a Progressive Web App running on your development machine, you probably want to test it from your phone as well. In a lot of situations, it is sufficient to just type in the IP address of your dev machine (assuming it's on your local network) and browse it. But in the case of a PWA, you need to have the website running on HTTPS.

How?

I registered a short domain name, c0dr.nl, and got a wildcard SSL certificate for that. I used DigiCert, but LetsEncrypt will work just as fine. Now instead of setting up a host with storage and such, just configure the DNS settings. I added an A record with an easy name, for example: 'twitch'. For the IP address, you'll have to add your local address. Not the one you got from your ISP, but the one you got from your local DHCP or that you entered in the IP settings. In my case, it's 192.168.1.13. That happens to be the same address I used for testing my PWA in the first place.

ISP DNS A-Record

What's left is to make sure that whatever you use to run your web app is using the certificate.

One last note. You don't have to use a wildcard certificate. But it will give you a little bit more flexibility when your IP address changes. You might work in different locations. At home and at the office. You can set up two different subdomains for that. If you only need one, use an '@' instead of a name in the A-record.

Posted on Dec 20 '19 by:

sorskoot profile

π“’π“Έπ“»π“Όπ“΄π“Έπ“Έπ“½πŸŒ·

@sorskoot

WebXR / WebVR πŸ₯½ Microsoft MVP πŸ±β€πŸ‘€ Frontend 🌷 LiveCoder πŸ“Ί Lead Web Developer πŸ•― Software Architect 🧱 Centric ✨

Discussion

markdown guide