Skip to content

Adding .head routes #184

@jeffrson

Description

@jeffrson

🚀 Feature Proposal

fastify-static could be enhanced by supplying
fastify.head
routes additionally to existing .get.

Motivation

HTTP HEAD request is a simple way to receive information about length of file, date of modification and etag. see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD

As it currently stands, every HTTP HEAD request (curl -I) gives 404 error.
The rather new fastify option exposeHeadRoutes does never return when used with fastify-static.

Example

For files it could be tested whether they need to be downloaded because of updates. Also it might be checked whether there is enough space in local cache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerssemver-minorIssue or PR that should land as semver minor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions