简体   繁体   中英

How to I get rid of extra / in http://localhost:8080/test/ in Jetty?

I want any user trying to access http://localhost:8080/test/ to be redirected to http://localhost:8080/test . I want to remove the extra '/' after test.

I tried writing this in rewrite rules but it doesn't work for me.

If your contextPath is /test then the extra slash is required to satisfy the context path rules of both the servlet spec and the URI / http resource declarations of the various RFCs.

If you set your web application, handler, context, etc with the "context path" of /test then you'll want to switch to using / (the root context) and having a servlet url-pattern of /test (exactly named /test ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM