Redirect http to https when using serve --ssl
See original GitHub issueIt 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.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to redirect HTTP to HTTPS Using .htaccess
Redirecting HTTP to HTTPS. 1. Redirect All Web Traffic. If you have existing code in your .htaccess, add the following: RewriteEngine On ...
Read more >How to Redirect HTTP to HTTPS - Semrush
How to Redirect from HTTP to HTTPS · 1. Choose a certificate for your site · 2. Tell Google about your new protocol...
Read more >Force your site to redirect to HTTPS (SSL)
When you add an SSL certificate to your website in the panel, DreamHost automatically redirects the URL visitors use to view your site...
Read more >IIS Redirect HTTP to HTTPS - SSL Certificates - Namecheap
Setting up an HTTP/HTTPS redirect in IIS. Once the SSL certificate is installed, your site still remains accessible via a regular insecure HTTP...
Read more >How to redirect all HTTP requests to HTTPS using .htaccess ...
If you want to redirect your users to HTTPS at all times, send them there from the "entry point" (the first link to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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’s not something which is supported, but more of a workaround.
Redirecting from http to https should not be
ng serve
responsibility unless it’s 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
andhttp-server
, which can be setup with minimal effort.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.