View Source BunnyCDNSigner (Bunny CDN URL Signer v0.1.2)

BunnyCDN signed urls using token authentication.

See https://support.bunny.net/hc/en-us/articles/360016055099-How-to-sign-URLs-for-BunnyCDN-Token-Authentication for more information.

Summary

Functions

Signs a URL with the given parameters.

Functions

Link to this function

sign_url(url, opts \\ [])

View Source

Signs a URL with the given parameters.

Parameters

  • url - The URL to sign
  • opts - A keyword list of options
    • :user_ip - The user's IP address
    • :expiration - The number of seconds until the token expires, defaults to 3,600 (1 hour)
    • :directory - Whether the URL is a directory (defaults to false)
    • :path_allowed - The path to allow
    • :countries_allowed - A comma-separated list of countries to allow
    • :countries_blocked - A comma-separated list of countries to block

Examples

sign_url("https://example.com/test.mp4")
"https://...?token=...&expires=..."

sign_url("https://example.com/test.mp4", directory: true)
"https://.../bcdn_token=...&expires=.../test.mp4"