Tuesday, 27 March 2012

How to serve static files from both IBM HTTP Server and an application in WebSphere Application Server

Saw this Technote in my Twitter river of news earlier : -


How can I configure IBM HTTP Server (IHS), and the IBM web server Plug-in, and my web application running in WebSphere Application Server (WAS), to serve some of my static files (JPG, GIF, CSS, JS, etc) from the IHS web server, but serve other static files from my web app running in WAS?


If you want to serve any static files (JPG, GIF, CSS, JS, etc) from your web application in WAS, you must use fileServingEnabled="true" in the ibm-web-ext.xmi file. That will cause the plug-in to use a wildcard entry for the context-root of your web application. For example, if the context-root is "myapp", then there will be a URI entry for "/myapp/*" in the plug-in config, and everything starting with "myapp" will be routed to the application in WAS.

Want to know more ? Then you know what to do ….


parul chaudhary said...

what to do when we want that IHS will serve static content.

Dave Hay said...

@Parul - by its very nature, IHS serves static content, such as HTML files. As an example, take a look at the file index.html which is located in the /htdocs subdirectory. If you place other files in the same location, they'll be served up by default. This is configured in httpd.conf. Perhaps take a look at the IHS or Apache docs for the htdocs directive etc., regards, Dave