Trouble refreshing files when using Caddy as a file server

1. The problem I’m having:

I’m using Caddy as a file server to serve RSS feeds using generated XML files. I’m able to do this using my Caddyfile, however, Caddy isn’t refreshing the file/feed when I update the file on the backend.

For example, I can successfully use Caddy to serve a file called atom.xml with 20 RSS feed items at myfeeds.duckdns.org/rss/atom.xml. However, when I add a new item to the file so that there are now 21 feed items, Caddy won’t pick up the 21st item and continues displaying the initial 20.

Manually restarting the Caddy container does not seem to resolve the issue.

2. Error messages and/or full log output:

N/A

3. Caddy version:

Caddy v2.6.4

4. How I installed and ran Caddy:

a. System environment:

Docker, docker-compose on Debian

b. Command:

N/A

c. Service/unit/compose file:

  caddy:
    image: caddy:2
    container_name: caddy
    restart: unless-stopped
    ports:
      - 443:443
    volumes:
      - ${APPDATA}/caddy/Caddyfile:/etc/caddy/Caddyfile
      - ${APPDATA}/caddy/site:/srv
      - ${APPDATA}/caddy/data:/data
      - ${APPDATA}/caddy/config:/config
    networks:
      - caddy

d. My complete Caddy config:

myfeeds.duckdns.org {

  # Serve all static files stored in /srv/rss folder
  file_server /rss/*

}

5. Links to relevant resources:

Test it using curl -v instead of your browser.

Your browser is probably caching the contents. (Though I’m not sure why it would be because file_server doesn’t write any Cache-Control headers).

We do write Etag… but I feel like that should be different if the file changes.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.