Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

How to run HTTPS using waitress? #377

Answered by tiangolo
fciamponi asked this question in Questions
Discussion options

Hello @tiangolo ,

Great work with this docker image, it's been a great help in getting part of my PhD up and running.

Right now, I'm trying to create a simple Flask API that takes static html files from a folder and returns them to the user.

For several reasons, at this stage I need both my frontend and backend running on a single container with waitress serving the flask app. I've managed to get it up and running using the API and Dockerfile in annex, and it successfully runs the app and returns the pages... however, it only works in HTTP when I use a virtual proxy, and I need them to be able to access via HTTPS only (it returns 500 Internal Server Error nginx/1.21.0 when using https requests).

Is there a way to incorporate HTTPS-only access to my build?

The commands I'm using to build and run (host address and email omitted for safety) my docker container are:

docker build -t test_uwsgi_nginx_flask .

docker run -dit -e "VIRTUAL_HOST=<my_address>" -e "LETSENCRYPT_HOST=<my_address>" -e "LETSENCRYPT_E MAIL=<my_email>" --name test_nginx_flask --restart always -p 8888:80 test_uwsgi_nginx_flask:latest

Thanks in advance for any assistance you can provide.

Best,
Felipe

flask_nginx_test.zip

You must be logged in to vote

I'm actually not sure what is waitress... 😅 but anyway, I would recommend you handle HTTPS outside, for example with Traefik, and then in this container handle only plain HTTP.

Replies: 1 comment

Comment options

I'm actually not sure what is waitress... 😅 but anyway, I would recommend you handle HTTPS outside, for example with Traefik, and then in this container handle only plain HTTP.

You must be logged in to vote
0 replies
Answer selected by tiangolo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #272 on August 29, 2024 00:24.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.