You can use protocol-relative URLs. If your media URLs omit the
protocol, they will inherit it from the protocol of the page:
<img src='//example.com/media/mypic.png'>
On a page served with https:, this image will be retrieved via https.
On an http: page, it will be retrieved via http.
More about this:
http://nedbatchelder.com/blog/200710/httphttps_transitions_and_relative_urls.html
--Ned.
[EMAIL PROTECTED] wrote:
> Does anyone have suggestions on how to make request.is_secure() work
> from behind a reverse proxy? I have nginx proxying to apache but since
> nginx (and not apache) is handling SSL the HTTPS environment variable
> that is_secure() reads from never gets set.
>
> This is easily solvable for standard redirects from http to https for
> certain paths. I can do this by putting them in nginx.conf. However, I
> want to have media served over SSL depending on whether the incoming
> request is SSL, I have some middleware to do this, but it relies on
> is_secure(). Any suggestions?
> >
>
>
--
Ned Batchelder, http://nedbatchelder.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---