Bug 66038 - mod_expires daily expiry enhancement request
Summary: mod_expires daily expiry enhancement request
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_expires (show other bugs)
Version: 2.5-HEAD
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-27 20:19 UTC by Seann Herdejurgen
Modified: 2022-10-17 12:28 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Seann Herdejurgen 2022-04-27 20:19:41 UTC
I have an HTML page with data that is updated once a day at 5pm. Ultimately I would like mod_expires to be able to expire this web page every Monday - Friday at 5pm, and will settle for expiring .html file daily at 5pm.

Diving deeper, the main HTML file is index.html and the daily updated file is mosaic.html which is a Server Side Include file, <!--#include virtual="mosaic.html"-->. The end user / browser never sees mosaic.html directly. Alternatively, if mod_expires could use the most recent modification time of any file that is server side included (e.g. mosaic.html), an ExpiresDefault "modification plus 1 day" rule might be able to solve this use case.
Comment 1 Seann Herdejurgen 2022-07-25 21:44:14 UTC
I have built a workaround, however it is kind of a kludge. I cache html files for a day after access. For html files with SSI content that is updated Monday-Friday at 5pm, I have a FilesMatch rule which expires these files a day after modification. In order for these files to have an expiration date in the future I implemented a cron job to touch these files everyday at 5pm, even on the weekend when data is not updated.

Here is the relevant configuration for this setup:

    <FilesMatch "\.(html)$">
        Header set Cache-Control "no-transform, s-maxage=86400, max-age=86400, stale-while-revalidate=7200, stale-if-error=7200"
        ExpiresActive on
        ExpiresDefault "access plus 1 day"
    </FilesMatch>

    <FilesMatch "(going-public|index|investing-basics|stock-investing|support-privacy|tools)\.html$">
        Header set Cache-Control "no-transform, s-maxage=3600, stale-while-revalidate=7200, stale-if-error=7200"
        ExpiresActive on
        ExpiresDefault "modification plus 1 day"
    </FilesMatch>