Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 251
Artem Ulko Avatar asked Jul 28 '17 11:07

Artem Ulko


People also ask

Is Django rest swagger deprecated?

Django REST Swagger: deprecated (2019-06-04)

Can I use swagger with Django?

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.

What is Restapi in Django?

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.

What is Django rest swagger?

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.


1 Answers

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;
like image 135
zaidfazil Avatar answered Sep 22 '22 02:09

zaidfazil