Siarhei Vouchak
Siarhei Vouchak

Reputation: 125

Redirect to URL with trailing slash doesn't occur in Websphere 8.5.5

There is an application that works on WAS7. It has war module deployed on context path "Foo/Bar" (compound one). That is the war module is accessible via the URL like this: localhost:9080/Foo/Bar.

Then I deployed the same application on WAS 8.5.5. Trying to access war module with the same URL localhost:9080/Foo/Bar (without trailing slash) and getting the "bare" page without css and js files retrieved. However, when I try to access module via the following URL localhost:9080/Foo/Bar/ (with trailing slash) css and js get picked up correctly.

What I was able to figure out so far, is that on WAS 7 everything worked because there was redirect from URL with no trailing slash to URL with trailing slash. And it seems like it is normal behavior http://webdesign.about.com/od/beginningtutorials/f/why-urls-end-in-slash.htm. The question is why don't I have the same behavior on WAS 8.5.5 ? Is there any way to configure it?

Upvotes: 4

Views: 2436

Answers (2)

oallauddin
oallauddin

Reputation: 94

Use documented in WAS9 Custom Properties

com.ibm.ws.webcontainer.redirectcontextroot

If set to true, and a request is made to the context root of an application with a missing trailing slash, the WebContainer appends the trailing slash. The WebContainer redirects to the URL with the appended slash before it applies any servlet filters defined in the application.

For example, a request to http://host:port/contextRoot is redirected to http://host:port/contextRoot/ before any filters are applied.

Name: com.ibm.ws.webcontainer.redirectcontextroot, Default value: false

Upvotes: 2

Siarhei Vouchak
Siarhei Vouchak

Reputation: 125

I spent some time debugging Websphere classes and found one property which I believe is the answer to my question: com.ibm.ws.webcontainer.redirectcontextroot. Bad news is that I can't find it to be mentioned in documentation related to WebContainer custom properties of Websphere.

So now redirect works as I expect but I'm confused with the fact that I'm using some undocumented feature...

Upvotes: 1

Related Questions