How can I tell chrome not to cache my Vaadin 24 page

Hi, Im designing a landing page for my application in Vaadin, and I want it to display an image of a pie chart (that represents the number of network elemets of every type in my application).

Every time you navigate to a page in Vaadin, the page’s constructor is called, so in the constructor I create a new updated image that displays the current distribution on network elements.

The problem is after the first time I load the application, Vaadin always displays the same first image, even if already deleted it.

I tryed a “cache breaker”: adding a time stamp to the name of the image, but it didnt help :frowning_with_open_mouth:

I attached the code.

s.txt (3.07 KB)

Anybody can help? :face_holding_back_tears:

You should use a streamResource: Images & Icons | Application Basics | Vaadin Docs

Here you are creating one file (same name) for all the users, and that’s not what you want.

Another example with a byte array: How do I convert a byte array to an Image - Vaadin Cookbook

It happend also when i used streamResource @faithful-emu

Anybody can offer a different solution?

Configure your Reverse Proxy in front of your application to always return no cache headers to this file if you can’t do it within your app.

Also keep in mind if the file is within your jar / war - that it’s highly like that changes to that file aren’t immediately available because java is caching calls within the class path resources