0

The docs state

Mixing HTTP and HTTPS on the same site is discouraged, therefore build_absolute_uri() will always generate an absolute URI with the same scheme the current request has. If you need to redirect users to HTTPS, it’s best to let your Web server redirect all HTTP traffic to HTTPS.

I have a https-only app behind nginx which converts all http requests to https. I get an incoming https call, but when I run request.build_absolute_uri() it gives me the request with a http and not https (so not the same scheme).

What is going wrong? Is there a setting I should add/change?

Private
  • 2,626
  • 1
  • 22
  • 39
  • 1
    Probably nginx doesn't properly communicate to Python that a secure connection is used. This depends on your specific nginx configuration. – deceze Jan 06 '20 at 10:13
  • Thanks @deceze any pointers on where I learn about this? I am not sure how nginx exactly would communicate this to django. – Private Jan 06 '20 at 10:15
  • @Private the dup should contains all relevant infos and links AFAICT. – bruno desthuilliers Jan 06 '20 at 11:30

0 Answers0