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 8044627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:17:18+00:00 2026-06-05T05:17:18+00:00

I have an Apache Tomcat server running. If I have something like: webapp/ image1.png

  • 0

I have an Apache Tomcat server running. If I have something like:

webapp/
    image1.png

Then, I can simply access it using:

example.com/image1.png

Which is perfect, except that I don’t have any control over what headers are being sent. I wish to send specific Expires header for certain MIME-types (like, for image/png). These headers will be static, so I don’t really mind if I have to specify this in some XML file and cannot be dynamic.

Is it possible with Apache Tomcat? The other obvious way is to read from the file and output it to the browser with the appropriate headers, but I think that it might be an overkill.

  • 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-05T05:17:20+00:00Added an answer on June 5, 2026 at 5:17 am

    Use Tomcat Filters for applying this headers.

    <web-app ...>
        ...
        <filter>
           <filter-name>ExpiresFilter</filter-name>
           <filter-class>org.apache.catalina.filters.ExpiresFilter</filter-class>
           <init-param>
              <param-name>ExpiresByType image</param-name>
              <param-value>access plus 10 minutes</param-value>
           </init-param>
           <init-param>
              <param-name>ExpiresByType text/css</param-name>
              <param-value>access plus 10 minutes</param-value>
           </init-param>
           <init-param>
              <param-name>ExpiresByType application/javascript</param-name>
              <param-value>access plus 10 minutes</param-value>
           </init-param>
        </filter>
        ...
        <filter-mapping>
           <filter-name>ExpiresFilter</filter-name>
           <url-pattern>/*</url-pattern>
           <dispatcher>REQUEST</dispatcher>
        </filter-mapping>
        ...
     </web-app>
    

    More Info at Tomcat Filter Documentation

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

Sidebar

Related Questions

I have a Tomcat server running some Jersey RESTful services and I'm using Apache
We have an application deployed on tomcat. To access application we are using apache
I have Sventon running on port 8090 of my server under Apache Tomcat. I
We have Tomcat application server set up at port 8080 and Apache Http Server
I have Apache Tomcat Version 7.0.26 running. A have a JAX-RS servlet under /test,
I have installed apache-tomcat-6.0.35-windows-x86 in my system. How can I configure it and set
I have an instance of Apache Tomcat 6.x running, and I want it to
I am using Tomcat 6 and have some questions about Apache mod_jk as follows.
I have been tasked to replace the hardware an existing Apache/Tomcat/MySQL application is running.
I am planning on using Apache Tomcat 6.0 as web server in my web

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.