Opened 17 years ago

Closed 17 years ago

#4294 closed (invalid)

get_image_url for ImageFields only return http and not https

Reported by: Oscar <ochen@…> 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.

Change History (1)

comment:1 by Fraser Nevett <mail@…>, 17 years ago

Resolution: invalid
Status: newclosed

The get_XXX_url() function uses urlparse.urljoin to combine settings.MEDIA_URL with the field's path.

I can only imagine you are experiencing the HTTP/HTTPS warning because your MEDIA_URL is 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_URL to "//media.example.com" (i.e. omit the http: 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.

Note: See TracTickets for help on using tickets.
Back to Top