django rest framework https for absolute urls?

后端 未结 2 1413
天涯浪人
天涯浪人 2021-01-05 17:04

The server hosting the api is returning http for absolute urls even though the page was loaded using https, does this have something to do with django rest framework? becaus

相关标签:
2条回答
  • 2021-01-05 17:19

    You need to make sure nginx forwards the client's request scheme because it'll make a regular http request to Django. You'll need to add the following line to your vhost definition:

    proxy_set_header X-Forwarded-Proto $scheme;
    
    0 讨论(0)
  • 2021-01-05 17:25

    Are you using Rest Framework reverse() function to build URLs? http://www.django-rest-framework.org/api-guide/reverse/

    It uses incoming request to determine the protocol used.

    0 讨论(0)
提交回复
热议问题