Issue
I am having a very strange situation where I am being redirected to my application URL ending with a /. This results in a 403 error Forbidden.
I have disabled the apache reverse proxy that I use. I have disabled all the spring security stuff that is configured so I would say this is all discarded. I debug the io.undertow.servlet.handlers handleRequest, which is the entry point of my servlets in Wildfly and I am getting in the method:
public void handleRequest(final HttpServerExchange exchange) throws Exception {
a
HttpServerExchange{ GET /app/
So it means that the redirection to the /app/ happens before the any servlet is invoked.
In the firefox developer console I see that 2 requests are made, one for 'app' and immediately after one to '/app/', which is the one that enters in the debug. In the response header of the 1st request (for 'app') I am getting:
Connection keep-alive Content-Length 0 Date Thu, 15 Nov 2018 11:23:06 GMT Location http://localhost:8080/app/ Server
WildFly/10 X-Powered-By Undertow/1
I understand that something in the Wildfly/undertow is redirecting my initial request to the /app/, but what can it be?
Interestingly I cannot see the response headers of the 1st request until the 2nd request is handled by wildfly.
Any help is much appreciated.
Solution
So it seems it's a feature of undertow... Some one requested adding an extra / if the content root was requested without the / and it was included in the version 1.0.0.Beta5.
https://issues.jboss.org/browse/UNDERTOW-89
EDIT:
First mistery was solved, the adding of the extra '/'. But why the 403 'Forbidden'? Well, it seems that some one forgot to add the index.html defined as welcome page. After adding the index.html it works all as expected...
Hope this helps other people having the same issue.
Answered By - daniel sp