drf_yasg 文档https配置
django 配置
settings.py
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
nginx 配置
加入X-Forwarded-Proto在配置中
proxy_set_header X-Forwarded-Proto https
/etc/nginx/conf.d/app_server.conf
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
来源:oschina
链接:https://my.oschina.net/tplinuxhyh/blog/3217837