Sign inSign up

mdworld/tinycors

By mdworld

Updated almost 6 years ago

A tiny CORS Anywhere proxy made with Go

Image
0

851

mdworld/tinycors repository overview

TinyCORS 🌱

A tiny CORS Anywhere proxy made with Go.

Adds CORS headers to each request to be able to call APIs that require CORS, without setting up your own server. Just start up this Docker container and start sending requests.

All requests to this proxy are allowed with this header: Access-Control-Allow-Origin: *! and proxied to the supplied URL. Also see CORS Anywhere and enable-cors.org.

Why another CORS proxy?

The most popular CORS Anywhere image (500k+ downloads at time of writing), uses the node:10-stretch image making it 337MB big, which is a lot for what it does. One of the smaller ones just uses an Nginx configuration and is 17MB.

This one uses Go (which compiles to a binary) and is an excellent candidate for multi-stage builds. The result is an image of just ~12MB!

Usage

When running on the default port, e.g. go to http://localhost:3000/?get=https://www.mdworld.nl

Go

go run tinycors.go

or with optional flags:

go run tinycors.go -port 9009 -origins http://localhost:3000

or build first:

go build tinycors.go ./tinycors

Docker
docker build -t mdworld/tinycors .
docker run --rm --name tinycors -p 3000:3000 mdworld/tinycors

or with optional flags:

docker run --rm --name tinycors -p 9009:9009 mdworld/tinycors -port 9009 -origins http://localhost:3000

Tag summary

Content type

Image

Digest

Size

6.3 MB

Last updated

almost 6 years ago

docker pull mdworld/tinycors