Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badges aren't updating due to being cached on GitHub. #3323

Closed
MikeHart85 opened this issue Nov 27, 2017 · 11 comments
Closed

Badges aren't updating due to being cached on GitHub. #3323

MikeHart85 opened this issue Nov 27, 2017 · 11 comments
Labels

Comments

@MikeHart85
Copy link

@MikeHart85 MikeHart85 commented Nov 27, 2017

Details

Probably affects everyone that uses badges. At least on GitHub.

Our RTFD badge has been showing "failing" for days now, even though the docs build successfully.

Appears to be happening because GitHub has the image cached on its own domain.

Had a look at HTTP headers:

https://readthedocs.org/projects/lewis/badge/?version=latest

302 Redirect
Cache-Control: "no-cache, no-store, must-revalidate, max-age=0"

https://media.readthedocs.org/static/projects/badges/passing.svg

200 OK
Cache-Control: "max-age=604800"

Seems likely that GitHub is ignoring the Cache-Control of the initial URL and respecting the Cache-Control of the redirect target... which means the badge will be cached for 604800 seconds == 7 days.

Related issues: #1612 and #3000.
Appears fixed in: 8c37801#diff-5d1a334650edab756ce4cdf8c531111e
Likely reintroduced by: 91f6c08#diff-5d1a334650edab756ce4cdf8c531111e

Note the latter commit was on Aug 17. Two new comments against #1612 since then complain that the problem still exists. Comments dated Aug 21 and Oct 31.

Expected Result

Badge should update when build status changes.

Actual Result

Badge doesn't update because it is cached.

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Dec 8, 2017

So we need to add the max age back in?

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Dec 8, 2017

I believe I can set this on nginx just for the badges directory, and it should fix it.

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Dec 8, 2017

Did some testing. Does this look like it will fix it?

HTTP/1.1 200 OK
Server: nginx/1.10.3 (Ubuntu)
Date: Fri, 08 Dec 2017 15:22:16 GMT
Content-Type: image/svg+xml
Content-Length: 790
Connection: keep-alive
Last-Modified: Friday, 08-Dec-2017 15:22:16 GMT
Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0
X-Deity: web01
Access-Control-Allow-Origin: *
X-Served: Nginx
Accept-Ranges: bytes

@dsuess
Copy link

@dsuess dsuess commented Dec 14, 2017

I still see the project in our project

Here is what the github people say: github/markup#224

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Dec 21, 2017

Believe this should be fixed.

@piccolbo
Copy link

@piccolbo piccolbo commented Aug 30, 2018

I can see it right now on my project:
https://github.com/piccolbo/altair_recipes

Badge is red but docs are right there in place. Last failed build close to two days old. Loading the image separately (per rst file) results in a green badge. The image appears to be cached by github per address bar if I open the image alone. Other badges are moving along just fine.

@piccolbo
Copy link

@piccolbo piccolbo commented Aug 30, 2018

Never mind I see there's a three days old fix. Hopefully it will kick in at some point.

@davidfischer
Copy link
Contributor

@davidfischer davidfischer commented Aug 30, 2018

I believe we have this corrected. However, we're waiting for two things:

  • Firstly we need github to pick up the change with their intermediate proxy. I assume this will happen relatively soon.
  • Secondly, users may need to flush their cache as github sent down the badge with 1 year cache headers.
$ curl -IL https://readthedocs.org/projects/pip/badge/
HTTP/1.1 200 OK
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: image/svg+xml
Content-Language: en
Expires: Thu, 30 Aug 2018 22:05:33 GMT
Last-Modified: Thu, 30 Aug 2018 22:05:33 GMT
Vary: Accept-Language, Cookie
Server: nginx/1.14.0 (Ubuntu)
X-Frame-Options: DENY
X-Deity: web04
Date: Thu, 30 Aug 2018 22:05:32 GMT

@piccolbo
Copy link

@piccolbo piccolbo commented Aug 31, 2018

Will keep an eye on it thanks.

@sjspielman
Copy link

@sjspielman sjspielman commented Jul 18, 2020

+1 This is ongoing. Any fixes?

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Jul 27, 2020

We are still setting the cache headers, do you have more information about this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants