Use Oracle's CDN for APEX Product Static Files

Use Oracle's CDN for APEX Product Static Files

Jon Dixon's photo
Jon Dixon
·Jun 17, 2022·

2 min read

Subscribe to my newsletter and never miss my upcoming articles

Take a load off your ORDS server and utilize Oracle's high-speed CDN to serve the APEX product static files for your instance. This has the dual effect of improving page load times and reducing the load on your ORDS server.

Use the CDN for a Specific Application

Shared Components > User Interface Attributes > General > Static File Prefix image.png

Note: When you set the CDN URL at the Application level, APEX will also look for 'Static Application Files' under this URL. In the example from the above screenshot, the substitution string #APP_FILES# will get changed to static.oracle.com/cdn/apex/21.2.4. If you want to reference custom JS, CSS, or Image files, you cannot store them under 'Static Application Files'. You will need to host custom static files in object storage, a file server, or your CDN and provide references to the complete URL for each file. In the below screenshot, the first reference will not work, and the second will work: image.png

Use the CDN for your Entire APEX Instance

To configure APEX to use the CDN URL for your entire APEX instance, run the following script from a schema that has the APEX_ADMINISTRATOR_ROLE database role.

begin 
  apex_instance_admin.set_parameter(
      p_parameter => 'IMAGE_PREFIX',
      p_value     => 'https://static.oracle.com/cdn/apex/21.2.4/');
  commit;
end;

Use the following to verify:
SELECT apex_instance_admin.get_parameter('IMAGE_PREFIX') FROM dual;

Just in case, here is the code to set it back:

begin
  apex_instance_admin.set_parameter
   (p_parameter => 'IMAGE_PREFIX',   
    p_value     => '/i/' );
   commit;   
 end;

Note: When you set the CDN URL at the Instance level, APEX will not look for 'Static Application Files' under this URL. This means you can add custom JS, CSS, or Image files in 'Static Application Files' as usual. In the below screen shot, both references will work: image.png

Remember!

  • Whenever you upgrade or patch APEX, you need to check if the CDN URL has changed and update it for each application or instance as appropriate.
  • In the unlikely event that your organization does not allow any outbound connections, then using an external CDN will not work for you.

Getting the Right CDN URL

As you can imagine, the CDN URL changes for each version of APEX and sometimes for each patch set bundle. You can get the correct URL for your version and patch set from the 'Known Issues' section of the APEX Download page for your version.

Example for APEX 21.2 image.png

Credits

🔗 Read More

 
Share this