A colleague of mine, Mark Mundy, recently got a query about using Traffic Director to server static content. Following on from that he put together this example of how it can be achieved.
Oracle Traffic Director version 12c (12.2.1) does support the serving of static content alongside the existing capability to cache content. More details on how this is achieved can be found here: http://docs.oracle.com/middleware/1221/otd/admin/vs.htm#OTADG3389
With this confirmed, I then utilised the current version of Java Cloud Service on an Oracle Cloud Machine to try out this capability. I created a simple WLS Service based upon 12.2.1 Enterprise Edition and selected to utilise a load balancer for my 2 manged server cluster. This ensured as part of the service I had provisioned a single instance of OTD 12.2.1 that I could then use to serve static content.
For this very simple test I created very basic html file that referenced an image file and my plan was to copy these two assets to the local storage of the OTD virtual machine hosting OTD. Below is the html file I used and you can see the referenced image that was stored alongside it. I created a basic index.html to ensure the file was servers when the default uri was accessed.
OTD executes under the oracle user and so I created a sub directory under the oracle home to store the html and the image
|Content Serving tab in Fusion Middleware Control UI|
Here I selected to ‘Create …’ a new content rule
In the dialogue presented I added the following:
|Rule to specify location of static content|
Once created there is the opportunity to go back into the rule and edit it further should you need to. You can for example allow directory listing if desired.
The rule is immediately activated in the running instance and so it is now possible to use a browser to request OTD to serve the html page.
This resulted in OTD responding with the default index.html from the directory associated with the rule created. The resulting page looking a little like this below.
|Web content delivered from OTD|