Skip to content

HTTP 103 Early Hints support #3237

Open
@junderw

Description

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

Feature Request

Motivation

https://developer.chrome.com/docs/web-platform/early-hints

Early Hints is a method for returning a list of resources to the client before actually sending back the actual response to their query.

This will help with performance on heavier SSR websites.

Proposal

enum EarlyHint {
    Preconnect(String),
    Script(String),
    Style(String),
}
async fn send_early_hint(hints: Vec<EarlyHint>) {
    // ... use tokio::spawn etc. to send off a HTTP 103 Early Hint Response
    // While the body of the handler function (after this await)
    // calls a billion databases to generate the HTML
}

// example
send_early_hint(vec![
    EarlyHint::Style("/main.css".into()),
    EarlyHint::Script("/main.js".into()),
    EarlyHint::Preconnect("https://fonts.google.com".into()),
]).await;

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.S-blockedStatus: marked as blocked ❌ on something else such as a PR or other implementation work.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions