configure SECURE_PROXY_SSL_HEADER like in answer above https://stackoverflow.com/a/72685575/1611526
class BothHttpAndHttpsSchemaGenerator(OpenAPISchemaGenerator):
def get_schema(self, request=None, public=False):
schema = super().get_schema(request, public)
if request.is_secure():
schema.schemes = ['https']
else:
schema.schemes = ['http']
return schema
then:
schema_view = get_schema_view(
...
generator_class=BothHttpAndHttpsSchemaGenerator,
)
This configuration works for dev and production environments.