Exposing an image via REST Endpoint and add 'Cache-Control' | Reactive

Hi all,

I am developing a way to fetch and cache images on the client side to improve page load performance. I have been successful through a workaround were I use a traditional web app's screen as a proxy to download the image and set the 'Cache-Control' header as 'public, max-age=XXXXXXXXX', in its 'Preparation'. 

Problem: with this solution the page load greatly improves over time, but on the first load, the images are being loaded synchronously. As such, I have been trying to adapt the logic to a rest API method to fetch the images asynchronously. The image content is sent in the body of a GET endpoint, and the headers are set using the same actions I used in the traditional web approach ('HTTPRequestHandler/AddHeader' actions) inside the method's 'server action'. I have achieved asynchronous load but the mentioned cache header isn't changing (cache.PNG for reference). 

My solution was inspired by the one proposed here 'https://www.outsystems.com/forge/component-overview/4528/db-image-cache' , however the cache header doesn't seem to work with this component too...

Does anyone have any idea on how I can tackle this issue?

Thanks in advance!

This is the image I am referencing in the post. Sorry to whom it might concern!



We have also had the issue with the REST Expose where the 'Cache Control' HTTP header is always overriden by OutSystems and is set to 'no-cache', even if we use the HTTPRequestHandler's action setHeader to change it to, for example, 'max-age=315360000' which would allow caching by the browser.

Does anyone know how to set 'Cache Control' header in OutSystems, in exposed REST actions, to something other than 'no-cache'? I believe that this would solve Luis' problem as well.

João Mateus

Yes, that would be the problem in my case too. Thank you João!  

Hello there

Is there any news regarding this cache-control topic?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.