Code

Opened 7 years ago

Closed 7 years ago

#4294 closed (invalid)

get_image_url for ImageFields only return http and not https

Reported by: Oscar <ochen@…> Owned by: adrian
Component: Database layer (models, ORM) Version: master
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: UI/UX:

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.

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by Fraser Nevett <mail@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.