-
Notifications
You must be signed in to change notification settings - Fork 88
How to proxy all HTTP requests to HTTPS
Lloyd Brookes edited this page Feb 8, 2018
·
1 revision
If you have an HTTPS server running at https://127.0.0.1:8000
then any HTTP requests to http://127.0.0.1:8000
will fail (as HTTP is a different protocol).
HTTP and HTTPS are two separate services. To respond to both HTTP and HTTPS requests both HTTP and HTTPS servers should be launched.
- Launch an HTTPS server. For example,
$ ws --https --port 8000
- Launch a separate HTTP server, hosting the same directory, on a different port of your choice. Configure a blanket rewrite rule to redirect all HTTP traffic to the HTTPS server.
$ ws --port 7000 --rewrite '/* -> https://127.0.0.1:8000/$1'
If your system permits it, you could launch the above servers on the standard ports of 80 (HTTP) and 443 (HTTPS).