On Thu, Jul 17, 2025 at 1:53 PM Ragavendhiran Bhiman (rabhiman) <rabhi...@cisco.com.invalid> wrote:
> Hi All, > > The callback as given below RedirectToSlashFilter needs to be called when > both /admin or /admin/ is given in the URL. > > > > <filter> > > <filter-name>RedirectToSlashFilter</filter-name> > > > <filter-class>com.cisco.cpm.admin.infra.utils.RedirectToSlashFilter</filter-class> > > </filter> > > > > <filter-mapping> > > <filter-name>RedirectToSlashFilter</filter-name> > > <url-pattern>/admin/*</url-pattern> > > </filter-mapping> > > > > <filter-mapping> > > <filter-name>RedirectToSlashFilter</filter-name> > > <url-pattern>/admin</url-pattern> > > </filter-mapping> > > > > <filter-mapping> > > <filter-name>RedirectToSlashFilter</filter-name> > > <url-pattern>/*</url-pattern> > > </filter-mapping> > > > > But the above configuration calls the RedirectToSlashFilter callback only > on /admin/ and not calling on /admin. This issue needs to be fixed how to > address this issue from the tomcat side. > > I tried many times the server side callback is not working for > RedirectToSlashFilter for the /admin and working for /admin/. Guide me to > fix this problem. > > > > Thanks & Regards, > > > > Raghav > > > > Cisco Confidential > You might find reading the specification for the url-pattern useful: https://jakarta.ee/specifications/servlet/6.0/jakarta-servlet-spec-6.0#mapping-requests-to-servlets >From what I understand, I don't think you need both the "/admin" and "/admin/*" patterns as the "/admin/*" one should be sufficient. I would expect a "GET /admin" request to be going to your filter with the configuration you have, but you might need to include more details (inline text only, no screenshots as the mailing list strips them). Maybe one of the Tomcat experts could correct or clarify here. Do you have some more detailed data on what is going on? (i.e. some logs showing the requests and "actions" happening on your filter) Is that your entire list of filters / mappings? Other ones could interfere. What version of Tomcat are you using? (helpful to know in case there are issues in a specific version)