Issue #77 duplicate
Assignee
Ian Lewis
Priority
major
Component
Milestone
Version
Watchers
2

[s3boto] custom domain hardcodes http or https

adamnelson avataradamnelson created an issue

When custom_domain==True, 'http' or 'https' is hardcoded. Either a new flag should be added to enable a url like 'custom_domain.com/file' or custom_domain should always use 'custom_domain.com/file' and secure_urls can be deprecated.

s3boto.py:217-218

    if self.custom_domain:
        return "%s://%s/%s" % ('https' if self.secure_urls else 'http', self.custom_domain, name)

Comments (8)

  1. adamnelson

    Since AWS_CUSTOM_DOMAIN hasn't been released yet, I decided to make a backwards incompatible change such that AWS_CUSTOM_DOMAIN must include the scheme.

    If AWS_CUSTOM_DOMAIN used to be 'xyz.cloudfront.com' it should now be 'xyz.cloudfront.com' or 'http://xyz.cloudfront.com'

    I'm open to renaming the variable to be more clear or having a second variable if anybody has an opinion.

    https://github.com/Yipit/django-storages/commit/515b3affcc9dca75847cb8de63989d2b0bdf103f

  2. Ian Lewis

    That might be a valid solution. Certainly in that case secure_urls wouldn't be needed. I'll have to think about it a bit more.

    I'd really like to limit the number of new variables. There are already like 4 variables that affect url generation.

    As a side note I usually see links without the protocol starting with ''. i.e. 'xyz.cloudfront.com' rather than simply just the domain. Otherwise the browser might get confused and think it's a file relative to the current file. Not sure the best-practice here so I'm someone is more informed than me, please let me know.

  3. Log in to comment »
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.