Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
View categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Troubleshooting Node.js Apps
      • Working with Node.js
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Model Context Protocol
    • Vector Database
    • Working with AI
    • Heroku Inference
      • Inference Essentials
      • AI Models
      • Inference API
      • Heroku Inference Quick Start Guides
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
Image Proxy

This add-on is operated by Copenhacken

Fast and secure image processing CDN. Easy integration with your stack.

Image Proxy

Last updated April 20, 2024

This is a draft article - the text and URL may change in the future. This article is unlisted. Only those with the link can access it.

The Image Proxy add-on is currently in beta.

Table of Contents

  • Provisioning the Add-on
  • Using with Ruby
  • Using with Ruby on Rails
  • Using with Node.js
  • Using with Python
  • Supported image formats
  • Removing the add-on
  • Support

Image Proxy is a fast and secure image processing CDN (Content Delivery Network) - you can host a single source file of your images and generate different size and format variants through URL parameters.

Image Proxy will load the source image, apply the requested processing, optimize the image file and cache the end result to be served as fast as possible to your users, using the most optimal image format and HTTP version for the requesting browser.

Provisioning the Add-on

Image Proxy can be attached to a Heroku application via the CLI:

$ heroku addons:create imgproxy --app example-app
-----> Adding imgproxy to example-app... done

A list of all plans available can be found here.

You can also do this from the Resources section of your application’s configuration page on Heroku.

Application Configuration

Once add-on has been provisioned, the following environment variables will be available in the app configuration:

  • IMGPROXY_URL
  • IMGPROXY_KEY
  • IMGPROXY_SALT
  • IMGPROXY_BASE64_ENCODE_URLS

Most client libraries and frameworks will pick up these environment variables and configure things automatically. For custom setups, you should configure your application to use them as provided. Keep in mind these variables might be eventually rotated.

The configuration can be confirmed using the heroku config command:

$ heroku config --app example-app | grep IMGPROXY

Using with Ruby

Edit your Gemfile, adding the following line and run bundle install

gem "imgproxy"

Then generate an Image Proxy URL, for example:

Imgproxy.url_for(
  "http://images.example.com/images/image.jpg",
  crop: {
    width: 500,
    height: 600,
    gravity: {
      type: :nowe,
      x_offset: 10,
      y_offset: 5
    }
  }
)

You can refer to the Ruby library documentation for the full list of options.

Using with Ruby on Rails

Edit your Gemfile, adding the following line and run bundle install

gem "imgproxy"

imgproxy.rb comes with the Active Storage support built-in. It is enabled automagically if you load imgproxy gem after rails (basically, just put gem "imgproxy" after gem "rails" in your Gemfile). Otherwise, modify your initializer at config/initializers/imgproxy.rb:

# config/initializers/imgproxy.rb

Imgproxy.extend_active_storage!

Now, to add imgproxy processing to your image attachments, just use the imgproxy_url method:

user.avatar.imgproxy_url(width: 500, height: 400, resizing_type: :fill)

This method will return a URL to your user’s avatar, resized to fill 500x400px on the fly.

You can refer to the Ruby library documentation for the full list of options.

Using with Node.js

Add the imgproxy-node dependency to your project:

$ npm install @imgproxy/imgproxy-node

Then generate an Image Proxy URL, for example:

import { generateImageUrl } from '@imgproxy/imgproxy-node';

const url = generateImageUrl({
  url: "https://example.com/image.jpg",
  options: {
    resize: {
      width: 100,
      height: 100,
      type: "fill",
      enlarge: 1,
      extend: { extend: 1 }
    },
    rotate: 90,
    quality: 80,
    format: "webp",
  }
});

You can refer to the Node.js library documentation for the full list of options.

Using with Python

Install the imgproxy Python library:

$ pip install imgproxy

Then generate an Image Proxy URL, for example:

import os
from imgproxy import ImgProxy

img_url = ImgProxy(
  "https://example.com/path/to/image.jpg",
  proxy_host=os.environ["IMGPROXY_ENDPOINT"],
  key=os.environ["IMGPROXY_KEY"],
  salt=os.environ["IMGPROXY_SALT"],
  width=800,
  height=400
)

Supported image formats

Conversion between images in PNG, JPEG, WebP, AVIF, GIF, ICO, SVG, HEIC, BMP and TIFF formats is supported.

Removing the add-on

The Image Proxy add-on can be removed via the CLI.

$ heroku addons:destroy bucketeer:test
-----> Removing bucketeer:test from sharp-mountain-4005... done, v20 (free)

This will destroy all the data associated with your instance and cannot be undone.

 

If re-provisioned, the add-on will setup new configuration variables and the old URLs will be invalid.

Support

All Image Proxy support and runtime issues should be submitted via the Heroku Support channels. We will do our best to assist you.

Feedback

Log in to submit feedback.

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices