All the URLS automatically generated in the BrowsableAPI docs and in the "url" attributes of the JSON responses are for HTTP protocol even though the site was accessed through a HTTPS protocol. This is because:
The nginx running on the host (not docker container) "catches" the HTTPS request and maps it to a HTTP request and sends it to the nginx running in the docker container
The nginx in the docker container is not adapted to accept HTTPS requests
The gunicorn running in the django container is not adapted to accept HTTPS requests
Add docker's network from the point above as an extenral network in the docker compose of microsimu
Add volumes for cert files (created by the docker compose in point 1) in microsimu's docker-compose so its nginx and gunicorn containers can access them
Problem
All the URLS automatically generated in the BrowsableAPI docs and in the "url" attributes of the JSON responses are for HTTP protocol even though the site was accessed through a HTTPS protocol. This is because:
Alternative 1
Consider this alternative:
The path the request would take would be:
Theoretically, the whole path would be through HTTPS requests.
Alternative 2
There's a way to make django "trust" HTTP requests if the right header is set. See https://docs.djangoproject.com/en/3.1/ref/settings/#std:setting-SECURE_PROXY_SSL_HEADER
EDIT: Chosen solution
I chose Alternative 2 and implemented it by configuring the host's nginx to set the header property "X-Forwarded-Porto" like this:
And the containerized nginx to forward that header like this:
And finally set Django to trust requests with that header set like this