Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8985729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:23:23+00:00 2026-06-15T21:23:23+00:00

I am using Tomcat 5.5 server and there is a web application deployed. I

  • 0

I am using Tomcat 5.5 server and there is a web application deployed. I want to block http requests which access the .txt files in my project. For example http urls like —
https ://MyDomain/inside/mytest.txt

I think this can be done using security-constraints in web.xml file or writing a custom valve. However, I am exploring the possibility of using robots.txt file as they seem very simple. So I have written a robots.txt file to block access to *.txt file as follows —

# go away
User-agent: *
Disallow: /*.txt

I have put it in the ROOT folder and also in all paths inside the webapps folder. However, it does-nt seem to have any effect and I am still able to access the *.txt files. Are there any other caveats and steps required for the robots.txt file to take affect in Tomcat? Any help here highly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:23:24+00:00Added an answer on June 15, 2026 at 9:23 pm

    robots.txt is a convention that is followed by Web Robots (such as search engine web crawlers), and it works because the Web Robot looks at this file and obeys the rules it finds in there. See http://www.robotstxt.org/ and particularly http://www.robotstxt.org/robotstxt.html for more information.

    Note that it is not intended as a security measure – it is an advisory protocol only, and any badly-behaved Web Robot is free to ignore it (as the server does not enforce its rules). In fact, robots.txt is not even aimed at human users, who are normally expected to be able to visit these pages.

    If you really want to block access to a file by all users of your web application (not just well-behaved automated web crawlers) then you will need to do something like security-constraints you mentioned.

    Another couple of alternatives:

    • Put the text files in the WEB-INF/classes/ folder of the web application as the contents of this folder are never served to web clients, but are available to the web application code itself using ClassLoader.getResourceAsStream for example.

    • Put the text files in the WEB-INF/ folder of the web application as the contents of this folder are never served to web clients, but are available to the web application code itself using ServletContext.getResourceAsStream for example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I run my java web application from eclipse using tomcat server, system gets
I have deployed a PHP application on my tomcat server(Tomcat 6.0).Previously I was using
I am using apache tomcat as a web server. I have deployed webservices on
I am using jsp to develop a web application...using tomcat server... I am facing
I've been working on a web application, deployed on Tomcat 7, which use EclipseLink
I am developing a java web application using eclipse and tomcat server. Application consists
I am using Tomcat server for my java based Application . My question is
I am currently using tomcat 6 as my Web Server. I have a very
I am running a web application using Tomcat and Java Servlets, JSP's, etc. I
I'm working on a web application for Apache Tomcat. I'm using a class called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.