I'm using the REST-framework for for API, and relationships to a HyperlinkModelSerializer are represented by a url that uses http. Is there any way to force this to return a link with https?
This might be an environment issue. In my case (on Heroku) I needed the production setting:
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
This is because internally the gunicorn instance is actually being connected to using http, you need to tell Django that there is a secure proxy in front of it. Pretty obvious once I stopped to think about it.
Interestingly enough all the other url reverses on the site work fine, just the DRF ones were broken, which was the confusing part.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With