4 ms·
Anyone care to shed why myapp.localhost:3000 (for the webapp I'm developing) is something that's useful for me rather than localhost:3000 ? EDIT: on linux and
by vlod 2y ago
Anyone care to shed why myapp.localhost:3000 (for the webapp I'm developing) is something that's useful for me rather than localhost:3000 ?
EDIT: on linux and don't use launchd, so I'd still the port number
- tgpc 2y agomaybe you're running a reverse proxy? it can direct you differently depending on how you refer to it
- csciutto 2y agoThe comparison is `myapp.localhost` vs `localhost:3000`. This is especially useful when you have web servers permanently running on your computer on ports, not just for momentaneous local development.
- jeroenhd 2y agoUsing real domain names lets you experience the web as it is in production. Localhost has a bunch of exceptions (i.e. HTTP URLs are treated as secure, CORS acts funny, etc.). Using domain names disables special handling of localhost URLs that'll help you spot problems before they hit production.
- vlod 2y agoThanks. This is the reason I wanted rather then convenience of not typing a port number (which I'd use a bookmark for, so I really don't care)
- ghoshbishakh 2y agoTrick: edit yuor /etc/hosts file and add a domain name. Self sign a certificate and add it to your trusted certificate list. Or - use https://pinggy.io https://pinggy.io
- deleted 2y ago[deleted]
- gwd 2y agoIt's `myapp.localhost` (without the port number). It's more useful because it's easier to allocate and remember a unique name than a unique port number.
- mrweasel 2y agoMaybe you have a stack of applications that needs to communicate. Seeing db.localhost is a little easier to read that db:3360, but especially if you have multiple web applications. It's easier to read sso.localhost, api.localhost, and www.localhost. They also show having the webserver to the TLS, that might be helpful.
- deleted 2y ago[deleted]
- cyral 2y agoNote the use of the Caddy webserver (you could also use nginx or whatever), which proxies to the port, so it's just myapp.localhost. I like this because it mirrors our production site. We can have subdomain.myapp.localhost and subdomain.myapp.com so links and everything work properly in both environments (assuming you have an env variable for the base domain)
- oulipo 2y agoCould there be a way to setup the Caddy server dynamically using eg direnv so that it's only launched when I'm in my dev folder?