Storage.Plug (PhoenixContribStorage v0.1.0)

View Source

A Plug for serving Storage files directly from your Phoenix application.

This is useful for local development or when you need to serve files through your application server instead of directly from the storage service.

Usage

Add to your router:

forward "/storage", Storage.Plug

Or with options:

forward "/storage", Storage.Plug, 
  cache_control: "public, max-age=31536000",
  gzip: true

Options

  • :cache_control - Cache-Control header value (default: "public, max-age=3600")
  • :gzip - Whether to gzip compress responses (default: false)
  • :etag - Whether to add ETag header (default: true)

Summary

Functions

call(conn, opts)

init(opts)