You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2023/01/03 15:57:05 UTC

Re: Query

Devatha,

On 12/31/22 14:13, Devatha Naga Puneeth wrote:
> How to disable the appending of trailing slash when client requests for the
> application root context ?

I'm curious, why is this a problem for you?

> Apache Tomcat Version : 9.0.65
> 
>   I have a sample folder in the webapps. When I access the sample
> application via http://localhost:8080/sample . Then it is redirecting to
> http://localhost:8080/sample/
> 
> When I use the command "curl -vL  http://localhost:8080/sample"
> <http://localhost:8080/sample>
> I got 302 response stating that application can be accessed via /sample/
> 
> I set *mapperContextRootRedirectEnabled *to false  in the context element
> of conf/server.xml to disable this behaviour and then restarted the tomcat
> . But it did not disable it .

The mapperContextRootRedirectEnabled setting does not disable the 
redirect; it only changes where the redirect is performed (Mapper vs 
DefaultServlet). If you want to disable redirection entirely, you'll 
have to map "/" to a specific servlet instead of allowing the 
DefaultServlet to handle requests to that resource. (And you will also 
have to set mapperContextRootRedirectEnabled="false" as well.)

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org