Skip to content

Latest commit

Β 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CORS Proxy

A simple CORS proxy built with Hono for Cloudflare Workers that allows you to access any web resource from your frontend application without CORS restrictions.

What it does

This proxy acts as an intermediary between your web app and any external API or resource, solving the CORS errors that would normally block direct requests from the browser.

Problems it solves:

  • ❌ CORS Error: "Access to fetch at 'https://api.example.com' from origin 'https://myapp.com' has been blocked by CORS policy"
  • ❌ APIs without CORS: Access to APIs that don't include CORS headers
  • ❌ Blocked resources: Images, videos or files from external domains

βœ… Works with:

  • πŸ–ΌοΈ Images: JPG, PNG, WebP, GIF, SVG
  • πŸ“Ή Videos: MP4, WebM, AVI
  • 🎡 Audio: MP3, WAV, OGG
  • πŸ“„ Documents: PDF, ZIP, binary files
  • 🌐 APIs: JSON, XML, HTML, CSS, JS
  • πŸ“± Any web content

Usage

Base URL

https://your-worker.your-subdomain.workers.dev/

Syntax

https://your-worker.your-subdomain.workers.dev/?url=TARGET_URL

Examples

Access an image:

<img src="https://your-worker.workers.dev/?url=https://example.com/image.jpg" />

Make an API request:

fetch("https://your-worker.workers.dev/?url=https://api.example.com/data.json")
  .then((response) => response.json())
  .then((data) => console.log(data));

With URLs that have parameters:

const targetUrl = "https://api.example.com/search?q=hello&limit=10";
const proxyUrl = `https://your-worker.workers.dev/?url=${encodeURIComponent(
  targetUrl
)}`;

Deploy on Cloudflare Workers

npm install -g wrangler
wrangler login
wrangler deploy

Features

  • πŸš€ Fast: Built with Hono, optimized for edge computing
  • 🌍 Global: Deployed on Cloudflare's global network
  • πŸ”’ Secure: URL validation and error handling
  • πŸ“¦ Lightweight: No unnecessary dependencies
  • 🎯 Versatile: Automatically handles any content type

Limitations

  • Only supports GET requests
  • URLs must start with http:// or https://
  • Subject to Cloudflare Workers limits

About

A tiny 🌐 CORS proxy built with Hono for Cloudflare Workers ⚑ fetch any web resource from your frontend without CORS headaches ✨.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages