lwsjs / local-web-server

A lean, modular web server for rapid full-stack development.
MIT License
1.22k stars 86 forks source link

Is it possible to redirect 'http' to https'? #82

Closed rethna2 closed 6 years ago

rethna2 commented 6 years ago

This simple server really works for me (spa and api proxy support) and many thanks to the developers and maintainers. Presently having it as below: ws --spa index.html --rewrite '/api/* -> https://backendapi.com/api/$1' -p 8080

Is it possible to redirect 'http' to https'? I am not reporting it as issue, but just asking as question. Would really appreciate any answer.

75lb commented 6 years ago

What exactly do you want to happen, could you spell it out to me please?

Do you want one of the following or something else?

  1. a request to http://localhost:8000 to return this response:

    HTTP/1.1 301 Moved Permanently
    Location: https://localhost:8000
  2. a request to http://localhost:8000 to be transparently proxied by the server to https://localhost:8000

rethna2 commented 6 years ago

I want the second one. I am getting a 404, for http://localhost:8000. I want to redirect to 'https://localhost:8000'.

75lb commented 6 years ago

The second example i gave is not a redirect, it is a proxy. If you want to proxy, read this.

rethna2 commented 6 years ago

Yes. You are correct. Thanks for the help.

75lb commented 6 years ago

you're welcome