Closed dkeulen closed 6 years ago
hi!
If you have an HTTPS server running (at https://127.0.0.1:8000
, for example) then any HTTP requests to http://127.0.0.1:8000
will fail (as it's a different protocol).
HTTP and HTTPS servers are two different things. If you want to respond to both HTTP and HTTPS requests you need both HTTP and HTTPS servers running.
So, launch your HTTPS server as normal. Then launch a separate HTTP server (on a different port of your choice) that hosts the same directory. Configure a blanket rewrite rule to redirect all HTTP traffic to the HTTPS server.
For example, with your HTTPS server already running, launch your HTTP server like this (insert your own specific port numbers):
$ ws --port 7000 --rewrite '/* -> https://127.0.0.1:8000/$1'
Thanks allot for the support and information!
You're welcome. I put the information in a wiki page. Feel free to edit the page or feedback on it.
Hi there,
First let me thank you for this great package. solved me some dev issues i was having. But i was wondering something, i have been browsing the wiki and also found the url redirect part.
But i can't get http to redirect to https when using --https. When running several tests, my tests (not written by myself) will run by the "will it redirect to https" part, and in that part the test crashes/errors out when http does not redirect (unfortunately).
So is there any info on how to acheive this with lws, or am i just missing it completely?