0
votes

I am using IBM WebSphere (WAS) 7.0.0.19 to host a java-based web-app, and I needed to map the extension *.html to a particular servlet so that I could do some server-side scrubbing of user-supplied HTML files. (The server reads the file, augments it with some extra information, and serves up the modified content transparently to the person viewing the page.)

Unfortunately, when I did this, welcome-files stopped working. Previously, if I typed in the URL for a directory, the server would look for index.html and serve up that. Now, I'm just getting a 403 forbidden rule ("Forbidden - by rule."). The access logs don't show anything more--they simply state that directory indexing is forbidden by rule for the server, which is correct. I don't want the webserver to build a table of contents for directories with no index.html, but when there is an index.html, I want it to serve up that file.

My first thought was that it was trying to serve the index.html through my servlet, the servlet was failing to find the file (because the url lacked "index.html"), and therefore it thought there was no index.html. However, I put in some debug code and am quite confident that the servlet code is never getting run when I go simply to the directory itself.

I don't really care whether index.html is served through the servlet or not--in the case of this particular file, the servlet would just spit back the original file anyway. I just want index.html to be served by something.

Here is the relevant section of my web.xml

<servlet-mapping>
    <servlet-name>PageScrubber</servlet-name>
    <url-pattern>*.html</url-pattern>
</servlet-mapping>        

<welcome-file-list>         
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

For what it's worth, index.htm and index.jsp were not working before the addition of the servlet mapping. Only index.html worked before. However, now none of them work.

I have used the same web.xml with two Oracle products: WebLogic (WLS) and Oracle Application Server (OAS) with no issues.

I am quite confident that it is just the addition of this scrubber servlet that has caused the problem, because removing that directive caused directory indexing to start working again.

I did find some notes about welcome-file-list not working when using an extended document root, and I tried setting com.ibm.ws.webcontainer.EnablePartialURLtoExtendedDocumentRoot to be true, but that did not seem to change anything.

I'm pretty much out of ideas. Does anyone out there have any thoughts as to why it's not finding my index.html? Thanks in advance!

1
One more piece of information to add: I tried changing the order of the <welcome-file> entries to put index.htm at the top. After doing so, the webserver still failed to find an index.htm, even though that should not match the wildcard.mikepr
Have you tried removing welcome-file-list (it's an optional according to web.xml schema) leaving only scrubber servlet? This -may- cause request to be routed to servlet, as it remains to be the only valid target for the .html mapping now.Kurtcebe Eroglu
Thanks for the suggestions. I tried removing the welcome-file-list, and it still didn't work. I haven't had any luck on the avenue Manglu suggested either. I'm still pursuing the issue and will post any results I am able to achieve.mikepr

1 Answers

1
votes

Caveat: I am working out of memory here.

The Welcome files used to be served by File Serving Servlet (or something that sounds similar to that).

This information would be in the WebSphere extensions file.

I would take a step back and remove your pageScrubber and get the file serving Servlet to serve the welcome files and see that things are working before getting back to using the PageScrubber.

These are my initial thoughts.

HTH