---
title: "Deploy Public Bucket Image Proxy"
description: "Public proxy for images in a bucket, with image optimization using imgproxy"
category: "Storage"
url: https://railway.com/deploy/public-bucket-image-proxy
---

# Deploy Public Bucket Image Proxy

Public proxy for images in a bucket, with image optimization using imgproxy

**[Deploy Public Bucket Image Proxy on Railway](https://railway.com/template/public-bucket-image-proxy)**

- **Creator:** timomeh
- **Category:** Storage
- **Total deploys:** 34

## Template content

### public imgproxy https://imgproxy.net/apple-touch-icon.png

- **Image:** ghcr.io/imgproxy/imgproxy:v3
- **Health check:** /health
- **Public domain:** Yes

## Buckets

- **raw images**

## Documentation

# Deploy and Host Public Bucket Image Proxy on Railway

A lightweight, high-performance image proxy that publicly serves images from a private bucket. It dynamically resizes and optimizes images on the fly using [imgproxy](https://imgproxy.net/), reducing bandwidth and improving load times without exposing your storage endpoints.

## About Hosting Public Bucket Image Proxy

Deploy a production-ready instance with zero configuration. It connects seamlessly to an S3-compatible Railway Bucket, giving you on-demand image transformations via simple URL parameters. Once deployed, it automatically handles proxying, optimizing and delivering images for websites, applications, and APIs. imgproxy is lightweight and resource-efficient, so it doesn't cost a lot to host on Railway.

## Common Use Cases

- **Serving User Uploads:** Upload user-generated images to the bucket and serve optimized versions to users
- **Optimizing images for blogs and websites:** Upload images for your blog or website to the bucket, and serve optimized versions to users

## Dependencies for Public Bucket Image Proxy Hosting

The template includes the S3-compatible bucket and the public imgproxy which optimizes the images on the fly.

### Deployment Dependencies

- [imgproxy](https://imgproxy.net/)
- [Railway Buckets](https://docs.railway.com/guides/storage-buckets)

### Implementation Details

- [imgproxy: Image Processing URLs](https://docs.imgproxy.net/usage/processing)
- [imgproxy: Serving files from S3](https://docs.imgproxy.net/image_sources/amazon_s3)
- [Railway Buckets](https://railway.com/changelog/2025-09-26-object-storage)
- [Vary for images on Cloudflare CDN for free](https://timomeh.de/posts/vary-for-images-on-cloudflare-cdn-for-free)

#### Upload images

Upload images into your bucket from your code with any S3-compatible library, or from a desktop app. For example:
- Bun's [built-in S3-client](https://bun.sh/docs/runtime/s3)
- Node.js [@aws-sdk/client-s3](https://www.npmjs.com/package/@aws-sdk/client-s3)
- Rails [Active Storage](https://guides.rubyonrails.org/active_storage_overview.html#s3-service-amazon-s3-and-s3-compatible-apis)
- [Transmit](https://panic.com/transmit/)

#### Serve optimized images publicly

Once an image is uploaded into the bucket, you can publicly access an optimized version by constructing a URL like this:

```
https://img.example.com/unsafe/q:80/w:1080/plain/s3://YOUR_BUCKET_NAME/duck.png
```

- `https://img.example.com` – use a railway.app domain or a custom domain. A custom domain allows you to use caching with a CDN
- `unsafe` – because it's publicly accessible, not a temporary signed URLs
- `q:80` – for quality of the optimized image, in this example 80. a number between 0 and 100
- `w:1080` – for a width of the resulting image, in this example 1080px
- `plain` – indicates that a plain URL will follow
- `s3://YOUR_BUCKET_NAME` – replace with the Railway Bucket's "Bucket Name" in the Credentials Tab (or use the `BUCKET` variable of the Railway Bucket)
- `duck.png` – the path to your file

imgproxy supports [many more URL parameters](https://docs.imgproxy.net/usage/processing).

#### (optional) Save bandwidth by adding a CDN

Add a custom domain to the imgproxy service, and use a DNS with a CDN Proxy like Cloudflare's "orange cloud". The CDN will cache the optimized images, so once the image is cached by the CDN, the cached version will be returned and the traffic doesn't even hit your service anymore.

When using Cloudflare, enable [Tiered Cache](https://developers.cloudflare.com/cache/how-to/tiered-cache/) for even more cache hits.

### License

The open source version of imgproxy is licensed under [MIT](https://github.com/imgproxy/imgproxy/blob/master/LICENSE)

## Why Deploy Public Bucket Image Proxy on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Public Bucket Image Proxy on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [Postgres Backup to Cloudflare R2 (S3-Compatible)](https://railway.com/deploy/postgres-to-r2-backup) — Automated PostgreSQL backups to S3-compatible storage with encryption

Open this page in a browser: https://railway.com/deploy/public-bucket-image-proxy
