"Redirect all HTTP requests to HTTPS" plugin required
See original GitHub issueRequested by @bennypowers in a separate thread:
One of the Lighthouse criteria is that the site redirects requests from http to https. Of course, I can set up rewrite according to the wiki page’s instructions, but that doesn’t give me the 302 Redirect I need to pass this audit. I’d very much like some feature like ws --server http2 --redirect-http-to-https which will take all requests and redirect them to https.
Could someone read this wiki page about extending ws
and come up with something to achieve this?
This would be the typical use case - server one serves the main HTTPS app: (you’ll probably need admin privileges to serve on system ports like 443 and 80).
$ ws --https --port 443
Server two catches stray HTTP traffic, loading a custom stack comprising your custom middleware (a local file called “redirect-everything.js” in this case) which returns the appropriate 302
response for each request received.
$ ws --port 80 --stack ./redirect-everything.js
It should be quite straight forward, not much code.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
Ok the following configuration works:
lws.config.js
lws.redirect.config.js
package.json
If i
sudo npm start
then I get the right behaviourResolved by the lws-redirect plugin.
Usage: