[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to block access to certain file extension in Tomcat

Posted on 2011-05-01
1
Medium Priority
?
696 Views
Last Modified: 2012-05-11
Hi,  if I have a test.txt file in the tomcat web directory and can be accessed via http://myserver.com/test.txt 

Where and how do i change the tomcat config to block access to all files with *.txt extension, so when user hits the url http://myserver.com/test.txt  they get an access denied or some kind of error.  

Thank you.
0
Comment
Question by:gagaliya
1 Comment
 
LVL 5

Accepted Solution

by:
SimonDard earned 2000 total points
ID: 35513784
You can find a URL Rewrite Filter here: http://www.tuckey.org/urlrewrite/ (manual at http://www.tuckey.org/urlrewrite/manual/3.0/)

Add a url-pattern for \.txt$  and set the response header to 'HTTP/x.y 404 Not Found' (x.y being the HTTP-version from the request), or rewrite to a non-existing URL for automatic 404 (quick & dirty hack).
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month19 days, 16 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question