Skip to Main Content

Caching APEX static files

Apache HTTP ServerThe APEX installation includes static files that are located on the web server. These files may changed normally only when you upgrade or apply patch to APEX. Because files are changing rarely, they are good subject stored to cache. If you use Apache HTTPD to serve static files, you can configure mod_file_cache for ones that are used most in your applications.

You might have also other static content e.g. images, JavaScript and CSS files that are stored to APEX workspace or application static files. Also these files aren't usually changed often and you can store files to cache and reduce calls to database. This can be done using HTTPD modules mod_cache and mod_cache_disk.

I provide here only basic information that you are aware about these HTTPD cache features and how those may used with APEX. Assumption is that you have knowledge how configure HTTPD. You need test and see how these works on your system.

First check are needed modules loaded to HTTPD. In Linux machine you can use command httpd -M to list all modules that are loaded.
You should look cache_module, cache_disk_module and file_cache_module.

Create configuration file called e.g. apex_file_cache.conf to specify the APEX static files you like cache. Here is example configuration file content for APEX 5.1.4 when applications use Universal Theme and styles Vita:

# APEX 5.1.4 mod_file_cache configuration for Universal Theme style Vita
<IfModule file_cache_module>
  # CSS
  CacheFile /apex/images/app_ui/css/Core.min.css
  CacheFile /apex/images/app_ui/css/Theme-Standard.min.css
  CacheFile /apex/images/libraries/jquery-ui/1.10.4/themes/base/jquery-ui.min.css
  CacheFile /apex/images/libraries/font-apex/1.0/css/font-apex.min.css
  CacheFile /apex/images/themes/theme_42/1.1/css/Core.min.css
  CacheFile /apex/images/themes/theme_42/1.1/css/Vita.min.css
  # JavaScript
  CacheFile /apex/images/libraries/apex/minified/desktop.min.js
  CacheFile /apex/images/libraries/hammer/2.0.4/hammer-2.0.4.min.js
  CacheFile /apex/images/libraries/apex/minified/widget.apexTabs.min.js
  CacheFile /apex/images/libraries/apex/minified/widget.stickyWidget.min.js
  CacheFile /apex/images/libraries/apex/minified/widget.stickyTableHeader.min.js
  CacheFile /apex/images/themes/theme_42/1.1/js/modernizr-custom.min.js
  CacheFile /apex/images/themes/theme_42/1.1/js/theme42.min.js

In example I use CacheFile directive but you should test does your platform support it or do you get better result with MMapFile directive. Check also path where the files are located in server. Include configuration file to your httpd.conf file, run test for configuration and restart HTTPD.

NOTE! when you upgrade or patch APEX, you need check are same files still relevant for cache and do changes accordingly to the configuration file. Also you need restart HTTPD to avoid end up serving requests that are completely bogus as mod_file_cache documentation says.
You shouldn't try cache all APEX +12 000 static files, that installation contains, with mod_file_cache. Most probably your applications isn't using those all even in special cases. You need carefully select only most used files.

To configure cache for APEX workspace and application static files create configuration file called e.g. apex_cache_disk.conf. Here is example configuration for workspaces ws1, ws2, ws3 and ws4:

# APEX 5.1.4 mod_cache configuration for static workspace and application files
<IfModule cache_disk_module>
  CacheRoot      /var/cache/httpd/proxy
  CacheEnable    disk /apex/ws1/r/
  CacheEnable    disk /apex/ws2/r/
  CacheEnable    disk /apex/ws3/r/
  CacheEnable    disk /apex/ws4/r/
  CacheLock      on

You need check what are URL's in your system relating to APEX workspace and application static files and adjust configuration accordingly. Include configuration file to your httpd.conf file, run test for configuration and restart HTTPD.

Optionally you can also add CacheIgnoreCacheControl directive that clients can't force refresh cache in HTTPD. Then it is recommended where you refer static file add query string to end. That way developers can force HTTPD fetch new file when files are changed. You can use e.g. APP_VERSION substitution string like:


If you change file in workspace or application static files, change also version attribute in application definitions so HTTPD knows reload file.
After enabling mod_cache, you should also see and setup htcachecleanup.

Depending if you aren't using RESTful services from APEX workspaces, after configuring mod_cache for workspace and application files, you might like check and change ORDS configuration for APEX_REST_PUBLIC_USER and APEX_LISTENER users pool. See if you can lower those pools jdbc.MinLimit so there aren't connections waiting for nothing while HTTPD serves workspace and application static files from cache.


  • Jari Laine 11 Dec 2021

    Hi greenmails,

    Thank you.

    By defaults comments need to be approved. Go to admin application and edit comment.

    If you have questions or other issues relating blog application, please report those in GitHub


  • greenmails 11 Dec 2021

    I tried your blog, thank you for share with everyone.
    I have a problem when comment but nothing display
    Have a nice day.

  • Marco Patzwahl 21 Mar 2019

    Good short article, gonna look into it. Have a nice day!