Opened 19 years ago
Closed 19 years ago
#4294 closed (invalid)
get_image_url for ImageFields only return http and not https
| Reported by: | Owned by: | Adrian Holovaty | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Keywords: | imagefield https ssl get_image_url | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
When using the get_image_url function for ImageField models, it doesnt detect whether the request is made from an http request or an https request. Rather it assumes it is an http request and calls images from that, spawning nag dialogs in IE.
Note:
See TracTickets
for help on using tickets.
The
get_XXX_url()function uses urlparse.urljoin to combinesettings.MEDIA_URLwith the field's path.I can only imagine you are experiencing the HTTP/HTTPS warning because your
MEDIA_URLis set to an absolute URL like "http://media.example.com". In this case, browsers will obviously use HTTP to access it, because that is what the scheme of the URL tells them to do.If you set
MEDIA_URLto "//media.example.com" (i.e. omit thehttp:but leave the double-slash prefix) then browsers should access the linked media using the same scheme as the one with which the page was requested.