Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

Should follow redirections but not cache against the redirected path #85

Open
uzyn opened this issue Jul 8, 2015 · 4 comments
Open

Comments

@uzyn
Copy link

uzyn commented Jul 8, 2015

I'm working on a flexible badge service, Umbo, that allows user to update the badge with any values.

Example: https://github.com/uzyn/umbo-weather/blob/master/README.md

To not reinvent the wheel, I'm relying on the great service, shields.io, for badge generation (for example: https://img.shields.io/badge/Singapore%2C%20Singapore-27.47%C2%B0C-yellow.svg)

For the example at umbo-weather, there's a background process that updates the value every 5 minutes.

The badge URL for Singapore weather is http://umbo.zynesis.com/singaporeio8gg0ok8ckwcck8.svg and it redirects to a different shields.io badge URL based on the value.

(Try going to http://umbo.zynesis.com/singaporeio8gg0ok8ckwcck8.svg in 5 minutes interval or so)

Camo, however, returns the final redirected URL and caches against that, of which the value never changes.

It would be great if Camo caches the original requesting URL instead. If not, what do you recommend that I should be doing for such service?

@atmos
Copy link
Owner

atmos commented Jul 10, 2015

What headers are you setting? GitHub uses camo/fastly and respects caching headers.

@uzyn
Copy link
Author

uzyn commented Jul 11, 2015

@atmos Here are the headers.

$ curl -i http://umbo.zynesis.com/singaporeio8gg0ok8ckwcck8.svg
HTTP/1.1 303 See Other
Server: Cowboy
Connection: keep-alive
X-Powered-By: Umbo 1.0.0 <umbo.io>
Access-Control-Allow-Origin: 
Access-Control-Allow-Credentials: 
Access-Control-Allow-Methods: 
Access-Control-Allow-Headers: 
Cache-Control: no-cache
Etag: 5732d227b1eaf5545a786fbdadaafccc812ab55f
Content-Type: image/svg+xml;charset=utf-8
Location: https://img.shields.io/badge/Singapore%2C%20Singapore-28.99%C2%B0C-yellow.svg
Set-Cookie: sails.sid=s%3AcZYsIV2YEOldVY8IG-WhoizndUGLiZfS.afH%2Fp%2Bg6eq904jAAFDGU%2Fq6DmdEdeyLx2aRo9GSV6Ac; Path=/; HttpOnly
Date: Sat, 11 Jul 2015 16:06:22 GMT
Transfer-Encoding: chunked
Via: 1.1 vegur

ETag is set too.

My case is rather unique in the sense that the redirected URL changes, ie, for the same URL:
http://umbo.zynesis.com/singaporeio8gg0ok8ckwcck8.svg

The generated badge is updated every 5 minutes, via different redirection URL, instead of via content changes.

@lifehome
Copy link

Camo, however, returns the final redirected URL and caches against that, of which the value never changes.

It would be great if Camo caches the original requesting URL instead. If not, what do you recommend that I should be doing for such service?

Why not both? Perhaps the hash could compare the Content-Length, then depends passing cached or renew the hash for being a new image?

@hiendv
Copy link

hiendv commented Aug 19, 2016

Sorry but anything new?
I'm sharing the same problem here: hiendv/hireable#1 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants