Sunday, August 2, 2020

HTTP 404 when enabling Friendly URLs or referencing Static Application Files using substitution string #APP_IMAGES#

As it is known, Oracle is trying to deprecate two web listeners Oracle HTTP Server (mod_plsql) and Embedded PL/SQL Gateway, and Oracle REST Data Services (ORDS) will be the only supported web listener for APEX.

However, if ORDS is not configured properly, error HTTP/HTTPS 404 could happen when

1. Friendly URLs property is enabled in APEX application

Error message as following
404 Not Found

When Friendly URLs property is enabled, the URL format looks like

Here, myworkspace is the value of RESTful Path Prefix property of APEX Workspace, default to the workspace name; myapp is the value of Application Alias property of APEX Application, default to the application name.

If Friendly URLs property is disabled, the URL format looks like

Here, 101 is the application ID of APEX application.

2. Substitution string #APP_IMAGES# is used to reference an image in Static Application Files

Error message as following
404 Not Found
The request could not be mapped to any database. Check the request URL is correct, and that URL to database mappings have been correctly configured

The referencing syntax looks like
<img src="#APP_IMAGES#logo.gif">

It will be translated into following format before sent to browser,
<img src="test/r/101/files/static/v4/logo.gif">


Both errors are caused by incorrect ORDS configuration. They can be fixed by executing following command
java -jar ords.war validate --database apex

If the error is still there, try following command
java -jar ords.war install advanced

No comments: