Documentation

Learn how to integrate ServeProxy and optimize your website images in minutes.

How It Works

ServeProxy is a high-performance image CDN built with Rust. When you request an image through our service, we automatically optimize and cache it for lightning-fast delivery worldwide.

The Process

  • Request: You send an image URL to ServeProxy
  • Fetch: We download the image from your origin server (first time only)
  • Optimize: Images are converted to modern formats like AVIF or WebP
  • Cache: The optimized image is stored in our multi-tier cache
  • Deliver: Served from the nearest location via Cloudflare's global network

Caching Duration

Cache Location Duration
ServeProxy Servers7 days
Cloudflare Edge Network14 days
User Browser7 days (via Cache-Control headers)
First Request vs Cached: The first time an image is requested, we fetch and optimize it (typically 1–3 seconds). All subsequent requests are served instantly from cache.

Image Optimization

ServeProxy automatically optimizes your images based on their format. We use modern compression techniques to reduce file sizes by 50–75% while maintaining visual quality.

Format Handling

Original Format Output Result
JPEG, PNG, BMP AVIF 50–75% smaller, same quality
Static WebP AVIF Further optimized compression
Animated GIF Animated WebP Preserves animation, smaller file
Static GIF AVIF Standard optimization
Animated WebP WebP (unchanged) Already optimized
SVG SVG (sanitized) Security cleaned, cached

Quality Settings

We use carefully tuned quality settings that balance file size and visual clarity. Most users can't tell the difference between the original and optimized version.

  • AVIF Compression: Quality level 75 provides excellent results for photos and graphics
  • WebP Animation: Maintains original frame timing and loop behaviour
  • SVG Safety: Removes scripts and potentially harmful content while preserving design
File Size Limit: Images larger than 5 MB will be rejected. Optimize large images before uploading them to your origin server.

Usage Limits

Rate Limiting

Limit Type Value
Uncached requests per IP5,000 every 10 minutes
Block duration if exceeded1 hour
Maximum image file size5 MB
Cached requests don't count. Only the first request for each unique image URL counts toward your rate limit. Once cached, the same image can be requested unlimited times.

Security Features

  • HTTPS Only: All images are fetched via HTTPS for security
  • SVG Sanitization: Scripts and harmful content removed from SVG files
  • Domain Filtering: Certain restricted domains are blocked automatically
  • Timeout Protection: Image fetches timeout after 15 seconds

Integration Examples

HTML Image Tag

html
<img src="https://serveproxy.com/?url=https%3A%2F%2Fexample.com%2Fimage.jpg"
     alt="Description"
     loading="lazy">

JavaScript Dynamic Loading

js
function loadOptimizedImage(originalUrl) {
    const encodedUrl = encodeURIComponent(originalUrl);
    return `https://serveproxy.com/?url=${encodedUrl}`;
}

const img = new Image();
img.src = loadOptimizedImage('https://example.com/image.jpg');
document.body.appendChild(img);

CSS Background Image

css
.hero {
    background-image: url('https://serveproxy.com/?url=https%3A%2F%2Fexample.com%2Fhero.jpg');
    background-size: cover;
    background-position: center;
}

React Component

jsx
function OptimizedImage({ src, alt, ...props }) {
    const optimizedSrc = `https://serveproxy.com/?url=${encodeURIComponent(src)}`;

    return (
        <img
            src={optimizedSrc}
            alt={alt}
            loading="lazy"
            {...props}
        />
    );
}

WordPress Integration

Free WordPress plugin

Install our plugin and all image URLs are automatically rewritten. No code changes required.

Download Plugin
Best Practices: Always use HTTPS URLs for origin images. Include appropriate alt text for accessibility. Use lazy loading for images below the fold. Consider srcset for responsive images at different sizes.

Checking If It Works

Response Headers

Open your browser's developer tools (F12) and check the Network tab. Look for these headers on your images:

response headers
X-Serveproxy-Cache-Status: HIT
X-Serveproxy-Image-Hash: abc123...
X-Serveproxy-Node: server-name
  • Cache-Status HIT: Image is being served from our cache
  • Content-Type: Shows the optimized format (usually image/avif or image/webp)
  • Cache-Control: Tells browsers to cache the image for 7 days

Common Issues

Problem Solution
Image not loading Check that the original URL is accessible and under 5 MB
429 error (rate limit) Wait 10 minutes or reduce request frequency
400 error Verify the URL is properly encoded and valid
Slow first load Normal — the first request fetches and processes the image
Statistics Endpoint: Visit https://serveproxy.com/stats to see service-wide statistics including total requests served in the past 7 days.