Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect from http to https in react?

My Audits in Chrome are showing me a net::ERR_EMPTY_RESPONSE because Lighthouse was unable to reliably load the page I requested. Google developers is giving me the suggestion to configure my server (node.js?) to redirect from http to https.

I tried the react module "react-https-redirect", but still not passing the audit. I implemented the module like so:

render() {
    return (
            <HttpsRedirect>
              <App />
            </HttpsRedirect>
    );
}

What do I have to configure to realise the automatic redirection?

like image 545
KurgerBing Avatar asked Sep 18 '25 14:09

KurgerBing


1 Answers

Answer is here you should use react-https-redirect but as the author says there is some security issues with this. if you can configure the server or use nginx as gateway that would be better than using this module.

like image 56
Siyavash vaez afshar Avatar answered Sep 21 '25 03:09

Siyavash vaez afshar