How configure django-rest-swagger to get a HTTPS requests?
upd: SSL cert is present and ALL app working with it, but swagger make a http requests.
How configure django-rest-swagger to get a HTTPS requests?
upd: SSL cert is present and ALL app working with it, but swagger make a http requests.
All the above solutions didn't work for me, so i did something HORRIBLE that worked:
Edited drf_yasg/openapi.py Line 260
From:
self.schemes = [url.scheme]
To:
self.schemes = ["https"]
Obviously you should not do this because the next time someone installs requirements this change will be lost. But it helped me to get the documentation working on my server.
@zaidfazil's answer almost worked for me. I had to add
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
to my django settings but then I had to add
proxy_set_header X-Forwarded-Proto https;
instead of:
proxy_set_header X-Forwarded-Protocol $scheme;
inside nginx's location block that serves the django app.
Add this setting in your
settings.py
,For more details, refer documentation..
Also, you may need to make sure your server is forwarding
x_forwarded_proto
and on nginx add this to your location within server config: