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.
Django REST Swagger: deprecated (2019-06-04)
As you can see, it doesn't take a lot of effort to integrate Swagger with Django REST Framework. It is straightforward and you can easily adjust settings to your preferences.
REST APIs are an industry-standard way for web services to send and receive data. They use HTTP request methods to facilitate the request-response cycle and typically transfer data using JSON, and more rarely - HTML, XML and other formats.
Django rest swagger is a python package for utilizing the power of swagger platform with django rest framework.You can install the django rest swagger using the pip command as following. pip instal django-rest-swagger==2.2.0. This will intsall django rest sawgger in your current virtualenviornment.Now.
Add this setting in your settings.py
,
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
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:
proxy_set_header X-Forwarded-Protocol $scheme;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With