Skip to content

Allow configuring cache header in ServeDir #611

@uzytkownik

Description

@uzytkownik
  • I have looked for existing issues (including closed) about this

Feature Request

Motivation

I'm using nix and because of nix quirk all files have last modified date of 1970. This is technically correct as the files are unchanged - server upon restart changes directory from which files are served. However this has side-effect of always having last modified date of 1970 and thus never refetched by browser.

I tried to append last modified header in axum but this just caused duplicate headers and did not resolve the problem.

On non-nix deployments it may be caused when kubernets are spinned for example during update. The last modified date is date when file was created so when container was create. This may be much earlier than when container is actually deployed causing a stale files being served from browser cache.

Proposal

Add a configuration option to ServeDir to be able to configure the behaviour (etag only, last-modified must be never older than axum start date etc.)

Alternatives

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions