It would be a nice feature to automatically redirect clients from http:// to https:// if the application is being served with --ssl.
It gets tricky to implement since the server only listens on one port and you can't serve http and https on the same port. What I do with other dev severs is listen on two ports such as 8080 and 8443 where if the dev goes to http 8080, it automatically redirects to https 8443. To support this, the --ssl option could take a port instead of a boolean. This would not override the --port option.
I'm OK with closing this as well with "devs need to be conditioned to use https" but I thought I'd open the discussion.
Can you provide the usecase for this feature? It really sounds like something a 'real' server should do but ng serve is meant to be used as a development only server only.
@filipesilva in early stage of development I use ng serve in production mode, so https redirection make sense
It would be nice for development, because if you type 'localhost:4200' in your address bar of your browser you get an error message (in Chrome ERR_EMPTY_RESPONSE for example) and i have to manually add https in front of localhost. It would be nice to just be redirected.
Hi, webpack dev server only listens on a single port. While there might be ways to listen to an addition port, this is something brittle as it鈥檚 not something which is supported, but more of a workaround.
Redirecting from http to https should not be ng serve responsibility unless it鈥檚 provided out of the box by the dev server which is not.
@mafshin, ng serve is not meant to be used for production nor as a server. There are better packages for that such as express and http-server, which can be setup with minimal effort.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._