Getting my API domain to be HTTPS

Posted November 22, 2020 778 views

I have a website ( hosted at Namecheap, it uses cloudflare & is HTTPS.

I have a server with digitalocean where I run my api, I added my domain to it so will resolve to my flask api. When I send a HTTP request from my web app ( to I get a ‘Mixed Content’ error, needs to be HTTPS (or my Flask Application does atleast). I have been looking to see how I can get certificates for Flask and I saw DigitalOcean offers certificates for your domains.

I made a new certificate for my domain & subdomain but I don’t know how I am going to make my Flask app run on HTTPS.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there,

What I could suggest is using Nginx as a reverse proxy for your Flask application. That way you will be able to add a Let’s Encrypt SSL using certbot.

You can follow the instructions on how to do that here:

Hope that this helps!

by Justin Ellingwood
by Kathleen Juell
In this guide, we will be setting up a simple Python application using the Flask microframework on Ubuntu 18.04. The bulk of this article will be about how to set up the uWSGI application server to launch the application and how to configure Nginx to act as a front-end reverse proxy.