Skip to content

Can't cache documents? #735

@reggi

Description

@reggi

Currently you can't cache a document because you can't change the status response using Etag / If-None-Match, curious if there's a reason this was only done for static content and not pages?

export const handler: Handlers = {
  async GET(req, ctx) {
    const resp = await ctx.render();
    
    const x = req.headers.get('If-None-Match')
    if (x === 'W/deadbeef') {
      return resp // need to send 304
    }
    
    resp.headers.set("ETag", "deadbeef");
    return resp;
  },
};

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