0

I've already deployed a website using https. Then I set up a python server api with flask and secure it with .crt and .key follow by a tutorial. Hence, I had https://a.xyz website for frontend and https://45.119.x.y:5000 for backend api

if __name__ == "__main__":
    context = ('server.crt', 'server.key')
    app.run(host='0.0.0.0', ssl_context=context)

I send http request from website front-end to backend and it returns POST https://45.119.x.y:5000/post net::ERR_CERT_AUTHORITY_INVALID.

Can I make my browser know my server backend? Thank you!

  • What browser are you using? The issue is that your browser doesn't accept self signed certs, but the solution depends on the browser. [This](https://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate) should work for Chrome. – SuperStormer Aug 29 '20 at 17:51
  • I'm using Vivaldi browser. I've already tested with Firefox and it also doesn't work – Le Vu Minh Huy Aug 29 '20 at 18:00

1 Answers1

0

If you are running backend server and frontend server on the same VM, you can run the backend server on HTTP and make use of Nginx for deploying your frontend application and making a reverse proxy call to the backend server from Nginx.

  • Just only the backend is on VM, I built the frontend website by zeit. Can I make it works if I build frontend website on VM too? – Le Vu Minh Huy Aug 29 '20 at 17:59
  • Yes you can create a static build of your website and use nginx server to host it on same VM where your backend resides. You can also add the SSL certificate path to nginx. After that you can setup reverse proxy link for your server which will be http://localhost:5000. – Sushrut Ashtikar Aug 29 '20 at 18:08