We have encountered an issue with APEX and how the applications respond to http HEAD requests. We initially wondered if it was something in our APEX/ORDS/Tomcat configuration, but have now turned up similar behavior in other places.
For example look at the output from these:
curl -v --url https://asktom.oracle.com/pls/apex/f?p=100:1:0 2>&1 | grep HTTP
> GET /pls/apex/f?p=100:1:0 HTTP/1.1
< HTTP/1.1 200 OK
curl -v -I --url https://asktom.oracle.com/pls/apex/f?p=100:1:0 2>&1 | grep HTTP
> HEAD /pls/apex/f?p=100:1:0 HTTP/1.1
< HTTP/1.1 404 Not Found
However:
curl -v -I --url https://asktom.oracle.com/i/ 2>&1 | grep HTTP
> HEAD /i/ HTTP/1.1
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
And this example:
wget -d https://apex.oracle.com/pls/apex/f?p=22927 2>&1 | grep HTTP
GET /pls/apex/f?p=22927 HTTP/1.0
HTTP request sent, awaiting response...
HTTP/1.1 302 Moved Temporarily
GET /pls/apex/f?p=22927:1:0 HTTP/1.0
HTTP request sent, awaiting response...
HTTP/1.1 302 Moved Temporarily
GET /pls/apex/f?p=22927:1:0::::: HTTP/1.0
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
wget -d --spider https://apex.oracle.com/pls/apex/f?p=22927 2>&1 | grep HTTP
HEAD /pls/apex/f?p=22927 HTTP/1.0
HTTP request sent, awaiting response...
HTTP/1.1 404 Not Found
In summary a GET request to an APEX URL returns a 200 response (or, an intermediate 302), however a HEAD request to the same URL returns 404.
A customer of ours uses http HEAD requests to validate published URLs and raises an error for followup if a 404 is encountered. In our case the URLs are exposed through an APEX application and the 404 is encountered.
Can someone please explain what is going on here and why.
Thanks very much.
Message was edited by: climatedb