0

it is my first post here.

Well, I made a lot of research before posting here and I really couldn't understand how to serve a reactjs app created with create-react-app (and compilted/built with it) through the https protocol.

I have got the self signed certificate but the "serve" npm package that I use (and which is the one the built create-react-app app is meant to be served with) can apparently not serve through https.

I also tried changing the server package, I tried http-server which seemed perfect for me except I use React Router in my app and this server can't deal with that.

I heard about using apache/nginx as a reverse proxy, could someone explain me how this works?

Have a nice day, Gab

Gab Orel
  • 11
  • 1
  • 1

1 Answers1

-1

You have to build your React app npm run build, then, take the dist folder, and serve it using your favorite webserver, like Apache or Nginx.

This medium post should be a good starting point : https://medium.com/@jgefroh/a-guide-to-using-nginx-for-static-websites-d96a9d034940

Never ever serve a production app with Webpack Dev Server, it's a dev tool and it's not made for production.

SylvainAr
  • 154
  • 5