tomcatweb.xml

Disable access by file extension in Tomcat web.xml


Thanks to everyone in advance -

How would I go about disabling access via the browser by filetype?

For instance if I wanted to disable all access to .xml files how would I go about doing this?

Thanks


Solution

  • As far as I know there is no straightforward solution for this. At the end of this post, it is explained how you can use JDBCRealm to create a security context around some files of your election. If a user tries to access a file that match your pattern (in your case *.xml), they would be redirected to a login or an error page.