Preact-cli: Replace localhost with a local domain name?

Created on 15 Nov 2017  路  5Comments  路  Source: preactjs/preact-cli


Do you want to request a feature or report a bug?
a question, but may be a feature if it's not yet supported

What is the current behavior?
I don't found how to serve on a specific URL rather than localhost. There is also your auto-SSL generation that doesn't works for me ( /usr/local/share/ca-certificates/devcert.cer doesn't exists on my Fedora 27 )

If the current behavior is a bug, please provide the steps to reproduce.
yarn serve

What is the expected behavior?
An option, like 芦 yarn serve --host myproject.local 禄 should be really useful if this doesn't yet exists.

If this is a feature request, what is motivation or use case for changing the behavior?
It's better to isolate each dev project on different URL, to separate correctly each service workers. I already have self-signed SSL certs on my local hostname.

Please mention other relevant information.

  • node version 8.7.0
  • npm version 5.4.2 but I uses yarn 1.3.2
  • Operating system Fedora 27
enhancement help wanted stale

Most helpful comment

The issue is about the serve command, so it's still relevant for the current release.

All 5 comments

I believe we might be missing a $HOST / --host option for preact serve.

Responding to the motivation part of your request though - ServiceWorkers are registered _per-origin_ (not per-hostname), so running two sites on different ports but the same hostname is sufficient to completely sandbox them from eachother.

We can change port number yes, but I don't known how others developers works, because in our company we keep the same domain name as the production website with a local TLDs (eg: prod = https://new-project-client.com and dev = https://new-project-client.local or https://new-project-client.com-local), and with an auto-signed SSL cert. This seems better than remembering each port number for each projects, and permit to uses subdomain (eg: locale/country management) and multiple TLDs (.com-local, .org-local ...)

Ah, I've generally used a local proxy for that, but I see how SSL makes things a little more complicated. Sounds like we should add $HOST :)

It seems host option is already available in preact watch

host: {
  description: 'Hostname to start a server on',
  default: '0.0.0.0',
  alias: 'H'
},

Is this still relevant or can we close this?

The issue is about the serve command, so it's still relevant for the current release.

Was this page helpful?
0 / 5 - 0 ratings