{"id":19837418,"url":"https://github.com/mdvanes/tinycors","last_synced_at":"2025-02-28T18:47:16.924Z","repository":{"id":64303365,"uuid":"301639045","full_name":"mdvanes/tinycors","owner":"mdvanes","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-19T14:31:54.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-11T11:14:09.355Z","etag":null,"topics":["cors","docker-container"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/mdworld/tinycors","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdvanes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-06T06:51:35.000Z","updated_at":"2022-09-19T14:28:23.000Z","dependencies_parsed_at":"2023-01-15T10:00:56.666Z","dependency_job_id":null,"html_url":"https://github.com/mdvanes/tinycors","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdvanes%2Ftinycors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdvanes%2Ftinycors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdvanes%2Ftinycors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdvanes%2Ftinycors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdvanes","download_url":"https://codeload.github.com/mdvanes/tinycors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241202463,"owners_count":19926613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cors","docker-container"],"created_at":"2024-11-12T12:14:22.076Z","updated_at":"2025-02-28T18:47:16.899Z","avatar_url":"https://github.com/mdvanes.png","language":"Go","readme":"# TinyCORS 🌱\n\nA tiny CORS Anywhere proxy made with Go.\n\nAdds 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.\n\nAll requests to this proxy are allowed with this header: `Access-Control-Allow-Origin: *!` and proxied to the supplied URL. Also see [CORS Anywhere](https://github.com/Rob--W/cors-anywhere) and [enable-cors.org](https://enable-cors.org/server.html).\n\n## Why another CORS proxy?\n\nThe most popular [CORS Anywhere image](https://hub.docker.com/r/imjacobclark/cors-container/tags) (500k+ downloads at time of writing), uses the `node:10-stretch` image making it 337MB big, which is a lot for what it does.\nOne of the smaller ones just uses an [Nginx configuration](https://hub.docker.com/r/shakyshane/nginx-cors) and is 17MB.\n\nThis one uses Go (which compiles to a binary) and is an excellent candidate for [multi-stage builds](https://docs.docker.com/develop/develop-images/multistage-build/). The result is an image of just ~12MB!\n\n## Usage\n\nWhen running on the default port, e.g. go to http://localhost:3000/?get=https://www.mdworld.nl\n\n### Go\n\n`go run tinycors.go`\n\nor with optional flags:\n\n`go run tinycors.go -port 9009 -origins http://localhost:3000`\n\nor build first:\n\n`go build tinycors.go`\n`./tinycors`\n\n### Docker\n\n```\ndocker build -t mdworld/tinycors .\ndocker run --rm --name tinycors -p 3000:3000 mdworld/tinycors\n```\n\nor with optional flags:\n\n`docker run --rm --name tinycors -p 9009:9009 mdworld/tinycors -port 9009 -origins http://localhost:3000`\n\n### Docker Compose\n\nExample docker-compose.yml:\n\n```\nversion: '3.8'\nservices:\n    tinycors:\n        ports:\n            - \"9009:9009\"\n        command: -port 9009 -origins http://localhost:3000\n        image: mdworld/tinycors\n        container_name: tinycors\n```\n\n## TODO\n\n* Change `/?get=x` to `/x` -\u003e do not rewrite `/http://x` to `/http:/x`, could use `r.URL.EscapedPath()` and split after the protocol and inject `//`\n* Reduce size below 7 MB (locally it shows 12.MB with `docker images | grep tinycors` but it shows 6MB on hub.docker.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdvanes%2Ftinycors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdvanes%2Ftinycors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdvanes%2Ftinycors/lists"}