Comments (6)
sure... we are doing that too. Ideally this code would be smart enough that we wouldn't have to though!
from imgix-rb.
We have this same setup with cloudfront. You could probably do something like this... Check if the string contains more than one '?'. If it does replace any following with '&'
from imgix-rb.
@benhutton what are you doing to work around this? I'm having trouble using a cache busting timestamp
from imgix-rb.
@axelson I've moved away from timestamps to asset fingerprinting based based on an md5 hash of the file contents. So, your filename looks like filename-hash.ext
. Here's an actual URL we're using: https://dg.imgix.net/waiting-for-god-to-text-back-vrcfown9-en/landscape/waiting-for-god-to-text-back-vrcfown9-1d26513c3498499dd96683b1dd770609.jpg
from imgix-rb.
Ah, ok. That's a bit harder for us since our server never touches the files, they go straight to s3. As far as I can tell it is actually impossible to use query parameters to bust Imgix's cache. At least I only need this as a temporary transition and Imgix's url purging endpoint seems to be working well.
from imgix-rb.
For anyone who might still be wondering about this issue/finding this over a year later, there are a few things I want to mention.
Although this might not have been the case when this issue was originally opened, in this project's latest release you can add the cache busting parameter in the following way:
client.path("/path/to/image.jpg").to_url({t:12345567})
# .../path/to/image.jpg?ixlib=rb-3.0.0&t=12345567
path()
should only be passed the image path (everything before ?
) while to_url()
can be used to append any number of query parameters. This would avoid the double ?
scenario, which can cause unexpected behavior on the imgix backend. Again, this behavior might not have always been the case. I also want to note that sometime in the future we will implement better path validation to avoid these types of scenarios.
Closing this issue now, but feel free to comment back with any questions.
from imgix-rb.
Related Issues (17)
- Rename :secure to :use_https in client initialization HOT 4
- feat: optionally disable path encoding HOT 6
- chore(test): more test dependencies to a separate group in Gemfile HOT 2
- feat: customize variable qualities
- feat: customize target Device Pixel Ratios
- Asset fingerprint gets URL-encoded and breaks image filenames HOT 2
- Does this library support purging images from cache? HOT 6
- Why does it alway return a secure URL? HOT 2
- Fix `?&s=` when signing URL without other params
- Remove `Client#sign_path`
- API options not supported, some error out HOT 2
- Expires query param? HOT 3
- Upgrading from 0.3.5 to 1.2.2 HOT 2
- Make signature optional HOT 4
- Introduce Rubocop HOT 2
- Support adding params joined with - HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgix-rb.