question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Redirect http to https when using serve --ssl

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Nov 11, 2018

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 and http-server, which can be setup with minimal effort.

1reaction
tandibarcommented, Jul 25, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found