Search code examples
pythondjangodjango-rest-frameworkswagger-2.0django-rest-swagger

Django REST Swagger HTTPS 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.


Solution

  • 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;