Hi,
QuestionHow can browser caching be enabled for the static files (graphics - png, jpeg - and CSS) served by an Apex website?
Attempts So FarI have tried two things so far:
1. Enabled caching within the Apex Application, via
Application Properties --> Security --> Browser Security. Set "Cache" to Enabled .
2. Amended the .htaccess file to include
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/png "access plus 4 months"
ExpiresByType image/jpeg "access plus 4 months"
# CSS and JavaScript
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
My Apex hosting company has confirmed that mod_expire is enabled.
Unfortunately, the static files are still not being cached (I'm using Chrome Developer tools to check this).
Chrome Developer tools also shows that the HTTP Response Headers include:
Cache-Control: no-store
[...]
Pragma: no-cache
(I'm aware that I can "cheat" and overwrite the Cache-Control value via
Application Properties --> Security --> Browser Security: HTTP Response Headers but can find no way to remove the Pragma from Response Header served.)
So...what am I doing wrong? How can Apex Browser Caching be correctly enabled?
Many thanks,
Greg
Assuming you are serving the content via ORDS, then browser caching should be automatic and there shouldn't be anything needed from your side of things.
For example, here's an AskTom page - you can see all of the CSS, images etc are all cached, with length expiry times.

If you're looking to avoid "first hit" costs per session, then you could also look at caching the resources on a webserver as well.
Peter covers this nicely here
https://www.oracle-and-apex.com/speeding-up-apex-static-application-and-workspace-files/