GitHub's Camo Aggressive Caching Prevent Diagrams from being Updated in Markdown

+1 vote
asked Feb 13 by Marcio
Hey PlantUML Team,

I use your proxy server to show UML diagrams in GitHub markdown files and they work just great. GitHub caches the generated images using a service of their own named "Camo" though:

That's a pain, given that the generated images don't get updated when I change my UML files.

I wonder if you guys could set the header "Cache-Control" to "no-cache" as a permanent solution to this issue?

(more details on the GitHub help page in the link)

Thanks, dudes.


1 Answer

0 votes
answered Feb 13 by plantuml (141,890 points)
Are you sure that the header "Cache-Control" is the source of this issue ?

Changing your UML file means changing the generated URL (for example from to )

If the UML source is different, then the generated URL is different. So "Cache-Control" should not be an issue here. Except if we miss something...
commented Feb 14 by Marcio

Thanks for the reply. I'm using the API (i.e.,<plantuml file's URL in rawgit>. I don't want to regenerate the URL every time. What I want is to change the UML file in my GitHub repository and see the correspondent rendered UML diagram image updated.

I called API in verbose (with cURL) and you are indeed setting "Cache-Control" with an expiration date. All you would need to do is set it to "no-cache" (as in the GitHub help page link I have provided previously).

commented Feb 14 by plantuml (141,890 points)
Ok so you are using /proxy?src=... We better understand the issue.

We are very uncomfortable about setting "Cache-Control" to "no-cache" for the whole proxy servlet, because we try to limit the usage of our bandwidth.

However, we have implemented something that might solve your issue :

If the user-agent of the HTTP request contains the string "Camo" (which is likely the case for request coming from GitHub server) then we remove Date / ETag headers and we add a "Cache-Control: no-cache" header instead. You can double-check this using cURL (so you need to setup a specific user-agent).

Tell us if it helps for the GItHub issue!

commented Feb 14 by Marcio

Thank you for looking into the issue! You guys rock! I have no idea what's the user agent though...

May I suggest a different solution? You could create a query parameter named "no_cache" and default it to "false" (or "cache" and default it to "true").  If caching is an issue, users could simply set the new query parameter to "no_cache=true" or "cache=false" in the request.

I think that this would be a more general solution which could possibly be applied to Camo or any other similar URL anonymizer or caching system calling your proxy server.

commented Feb 14 by plantuml (141,890 points)
Good idea!
So you can now have:

The "Camo" user-agent stuff is still there also.

Tell us if it solves your issue!
commented Feb 14 by Marcio
Perfect! Thanks so much! It should solve the issue (I see "Cache-Control: no_cache" in the headers when I call your proxy server).
commented Feb 15 by Marcio
Hi Again,

I asked GitHub's support what's the user agent they use and here's the answer:

"Hi Marcio,

Thanks for reaching out to GitHub Support about camo.

Camo uses a user agent of "Camo Asset Proxy #{version}"

I hope that this is the information you were seeking. Let me know if I can be of further help.


GitHub Support"

I think you could simply remove the user agent checking altogether, given that the new query parameter would suffice, but here's the info anyway in case you want to keep it.