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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:40:09+00:00 2026-05-11T07:40:09+00:00

In Apache’s mod_expires module, there is the Expires directive with two base time periods,

  • 0

In Apache’s mod_expires module, there is the Expires directive with two base time periods, access, and modification.

ExpiresByType text/html 'access plus 30 days' 

understandably means that the cache will request for fresh content after 30 days.

However,

ExpiresByType text/html 'modification plus 2 hours' 

doesn’t make intuitive sense.

How does the browser cache know that the file has been modified unless it makes a request to the server? And if it is making a call to the server, what is the use of caching this directive? It seems to me that I am not understanding some crucial part of caching. Please enlighten me.

  • 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. 2026-05-11T07:40:09+00:00Added an answer on May 11, 2026 at 7:40 am

    An Expires* directive with ‘modification’ as its base refers to the modification time of the file on the server. So if you set, say, ‘modification plus 2 hours’, any browser that requests content within 2 hours after the file is modified (on the server) will cache that content until 2 hours after the file’s modification time. And the browser knows when that time is because the server sends an Expires header with the proper expiration time.

    Let me explain with an example: say your Apache configuration includes the line

    ExpiresDefault modification plus 2 hours 

    and you have a file index.html, which the ExpiresDefault directive applies to, on the server. Suppose you upload a version of index.html at 9:53 GMT, overwriting the previous existing index.html (if there was one). So now the modification time of index.html is 9:53 GMT. If you were running ls -l on the server (or dir on Windows), you would see it in the listing:

    -rw-r--r--  1 apache apache    4096  Feb 18 09:53 index.html 

    Now, with every request, Apache sends the Last-Modified header with the last modification time of the file. Since you have that ExpiresDefault directive, it will also send the Expires header with a time equal to the modification time of the file (9:53) plus two hours. So here is part of what the browser sees:

    Last-Modified: Wed, 18 Feb 2009 09:53:00 GMT Expires: Wed, 18 Feb 2009 11:53:00 GMT 

    If the time at which the browser makes this request is before 11:53 GMT, the browser will cache the page, because it has not yet expired. So if the user first visits the page at 11:00 GMT, and then goes to the same page again at 11:30 GMT, the browser will see that its cached version is still valid and will not (or rather, is allowed not to) make a new HTTP request.

    If the user goes to the page a third time at 12:00 GMT, the browser sees that its cached version has now expired (it’s after 11:53) so it attempts to validate the page, sending a request to the server with a If-Modified-Since header. A 304 (not modified) response with no body will be returned since the page’s date has not been altered since it was first served. Since the expiry date has passed — the page is ‘stale’ — a validation request will be made every subsequent time the page is visited until validation fails.

    Now, let’s pretend instead that you uploaded a new version of the page at 11:57. In this case, the browser’s attempt to validate the old version of the page at 12:00 fails and it receives in the response, along with the new page, these two new headers:

    Last-Modified: Wed, 18 Feb 2009 11:57:00 GMT Expires: Wed, 18 Feb 2009 13:57:00 GMT 

    (The last modification time of the file becomes 11:57 upon upload of the new version, and Apache calculates the expiration time as 11:57 + 2:00 = 13:57 GMT.)

    Validation (using the more recent date) will not be required now until 13:57.

    (Note of course that many other things are sent along with the two headers I listed above, I just trimmed out all the rest for simplicity)

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

Sidebar

Ask A Question

Stats

  • Questions 72k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Indeed JCA seems the most appropriate technology for you. Already… May 11, 2026 at 1:51 pm
  • added an answer INSERT INTO anothertable (list, of , column, names, to, give,… May 11, 2026 at 1:51 pm
  • added an answer I wouldn't restrict yourself to one filter per assembly. You… May 11, 2026 at 1:50 pm

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.