Setting up https on Debian server


I need my work-in-progress streamlit server to be served via https, i.e. This is currently deployed on a Debian AWS instance provided by bitnami. On the instance i have been running mostly Apache/Flask/gunicorn apps.

It seems like there would be two basic ways to do this – to proxy from Apache to Streamlit, or to modify Streamlit’s tornado server so it serves https. Which is better/easier? I assume that for the Apache path, I could do most of what I need to in the httpd.conf file.

Did the streamlit install put this in? I don’t remember doing it. This looks like the operative part, and maybe all I need to do is change HTTP_HOST to HTTPS_HOST. Thoughts?

<IfModule mod_proxy.c>
    ProxyPass /.well-known !
  # END: Support domain renewal when using mod_proxy without Location
  # BEGIN: Enable non-www to www redirection
  RewriteEngine On
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteCond %{HTTP_HOST} !^localhost
  RewriteCond %{HTTP_HOST} !^[0-9]+.[0-9]+.[0-9]+.[0-9]+(:[0-9]+)?$
  RewriteCond %{REQUEST_URI} !^/\.well-known
  RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=permanent,L]
  # END: Enable non-www to www redirection
  RewriteRule ^.*$ http://%{HTTP_HOST**}:8501%**{REQUEST_URI}
  <Directory "/opt/bitnami/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny                          
      Allow from all
    <IfVersion >= 2.3 >
      Require all granted