hauleth

hauleth

Simple plug for sending HTTP 103 Early Hints Link headers to improve performance of the first load of your applications

103 Early Hints is a way to send to browser information about resources that will be needed later. It is an alternative to HTTP push that is easier for the developers and browsers, as you do not need to manage cache checking on your own. Usage is pretty simple:

plug PlugEarlyHints,
  # List all resources that will be needed later when rendering page
  paths: [
    # External resources that will be connected to as we will use
    # different resources from it. It will speedup as the TLS handshake
    # will be already ended, so we will be able to fetch resources
    # right away
    "https://gravatar.com/": [rel: "dns-prefetch"],
    "https://gravatar.com/": [rel: "preconnect"],
    # "Regular" resources. We need to set `:as` to inform the client
    # (browser) what kinf of resource it is, so it will be able to
    # properly connect them
    "/css/app.css": [rel: "preload", as: "style"],
    "/js/app.js": [rel: "preload", as: "script"],
    # Preloading fonts will require additional `:type` and `:crossorgin`
    # to allow CSS engine to properly detect when apply the resource as
    # well as to prevent double load.
    "/fonts/recursive.woff2": [
      rel: "preload",
      as: "font",
      crossorgin: :anonymous,
      type: "font/woff2"
    ]
  ]

It also supports 2 additional options :callback that supports modifying entries paths in the runtime (useful for Phoenix static assets that are dynamic in their nature) and :enable that allows to dynamically decide when to apply early hints (as it doesn’t really make sense for example for non-HTML resources and can cause problems with non-conforming HTTP clients).

Where Next? Top

Trending in Announcing Top

type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
kip
In 2021 I started a new library called Tempo with the objective of modelling time as a set of intervals - not as instants. In 2022 I gave...
New
quatermain
Hello, I’m sharing my plugin here in forum after some time so it has time to mature and proof yourself. I use Claude Code daily on a pr...
New
gtcode
Aloha gang, There’s a new class of AI model out from TypeSafe. Jev is their flagship model. You can learn about it here: ...
New
LostKobrakai
I’ve recently created a small library phoenix_vite integrating the vite build tooling with phoenix. It provides an igniter.installer t...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
CodeSync
Code BEAM Europe 2026 – Call for Talks is Open! We’re excited to announce that Code BEAM Europe 2026 is now open for talk submissions :t...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews