OgEx.ResourceLoader.Remote (og_ex v0.2.0)

Copy Markdown View Source

Opt-in HTTP loader for images embedded in generated cards.

Each request resolves and validates the destination before connecting. The request URL is rewritten to the selected address while TLS verification and the Host header retain the original hostname, preventing DNS rebinding.

Remote loading is disabled by default and requires an explicit hostname allowlist. Redirect targets are subjected to the same scheme, hostname, DNS, and address checks. Direct external og:image values do not use this module because OgEx emits those URLs without fetching them.

The README's embedded-external example shows the complete allowlist, controller, card HEEx, and generated output.

Summary

Functions

Loads an allowlisted remote source.

Functions

load(source, options \\ [])

Loads an allowlisted remote source.

options override the application :remote_images keyword configuration for this call. The function uses the configured resource cache, performs conditional revalidation when possible, and returns {:ok, resource} or a structured error.