{"id":46084151,"url":"https://github.com/ctoth/corsair","last_synced_at":"2026-06-07T01:02:18.405Z","repository":{"id":209347888,"uuid":"723802321","full_name":"ctoth/corsair","owner":"ctoth","description":"Proxy to remove CORS restrictions with streaming support","archived":false,"fork":false,"pushed_at":"2025-02-21T02:59:07.000Z","size":839,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T18:27:39.853Z","etag":null,"topics":["cors","proxy"],"latest_commit_sha":null,"homepage":"","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/ctoth.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-11-26T19:56:55.000Z","updated_at":"2025-02-21T02:59:10.000Z","dependencies_parsed_at":"2023-12-08T04:23:24.259Z","dependency_job_id":"38118023-b6d7-4c7b-98c0-162a7733ef77","html_url":"https://github.com/ctoth/corsair","commit_stats":null,"previous_names":["ctoth/corsair"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/ctoth/corsair","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctoth%2Fcorsair","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctoth%2Fcorsair/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctoth%2Fcorsair/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctoth%2Fcorsair/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctoth","download_url":"https://codeload.github.com/ctoth/corsair/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctoth%2Fcorsair/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29974710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T15:41:30.362Z","status":"ssl_error","status_checked_at":"2026-03-01T15:37:07.343Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","proxy"],"created_at":"2026-03-01T16:17:54.044Z","updated_at":"2026-03-01T16:17:54.607Z","avatar_url":"https://github.com/ctoth.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"logo.png\" alt=\"Logo\" width=\"200\"/\u003e\n\n# Corsair\n\nCorsair is a high-performance HTTP proxy server written in Go that enables cross-origin requests by handling CORS headers. It acts as an intermediary between your frontend application and APIs that don't support CORS, allowing you to make requests to any domain while maintaining security and performance.\n\n## Features\n\n- **CORS Handling**: Automatically adds appropriate CORS headers to enable cross-origin requests\n- **Smart Caching**: Built-in LRU cache with ETag and Last-Modified support\n- **Performance Monitoring**: Prometheus metrics for request tracking and performance analysis\n- **Streaming Support**: Handles streaming responses for video/audio content\n- **Flexible Configuration**: Configurable via both environment variables and command-line flags\n- **Health Checks**: Built-in health check endpoint\n- **Domain Filtering**: Optional whitelist of allowed domains\n- **Redirect Handling**: Properly follows HTTP redirects\n- **Request Forwarding**: Preserves headers and request methods\n\n## Getting Started\n\nYou can run Corsair either directly as a Go binary or using Docker.\n\n### Prerequisites\n\n#### For Docker\n- Docker\n\n#### For Direct Installation\n- Go 1.16 or higher\n- Git\n\n### Installation\n\n#### Using Docker\n\n1. Build the image:\n```sh\ndocker build -t corsair .\n```\n\n2. Run the container:\n```sh\ndocker run -d -p 8080:8080 --name corsair corsair\n```\n\n#### Using Go\n\n1. Clone the repository:\n```sh\ngit clone https://github.com/yourusername/corsair.git\ncd corsair\n```\n\n2. Build the binary:\n```sh\ngo build -o corsair\n```\n\n3. Run the server:\n```sh\n./corsair\n```\n\n## Usage\n\n### Basic Usage\n\nTo proxy a request through Corsair, add your target URL as a query parameter:\n\n```\nhttp://localhost:8080/?url=https://api.example.com/data\n```\n\n### API Documentation\n\n#### Main Proxy Endpoint (/)\n- Method: GET, POST, OPTIONS\n- Query Parameters:\n  - `url`: (Required) The target URL to proxy\n- Example: `curl \"http://localhost:8080/?url=https://api.example.com/data\"`\n\n#### Health Check (/health)\n- Method: GET\n- Returns: 200 OK when service is healthy\n- Example: `curl http://localhost:8080/health`\n\n#### Metrics (/metrics)\n- Method: GET\n- Returns: Prometheus metrics\n- Example: `curl http://localhost:8080/metrics`\n\n### Configuration\n\nCorsair can be configured through environment variables or command-line flags. Flags take precedence over environment variables.\n\n#### Environment Variables\n\n| Variable | Description | Default | Example |\n|----------|-------------|---------|---------|\n| `CORSAIR_PORT` | Server port | 8080 | `8081` |\n| `CORSAIR_INTERFACE` | Network interface | localhost | `0.0.0.0` |\n| `CORSAIR_DOMAINS` | Allowed domains (comma-separated) | * | `api1.com,api2.com` |\n| `CORSAIR_TIMEOUT` | Client timeout (seconds) | 15 | `30` |\n| `CORSAIR_CACHE_SIZE` | LRU cache size | 100 | `1000` |\n\n#### Command-Line Flags\n\n| Flag | Description | Default | Example |\n|------|-------------|---------|---------|\n| `--port` | Server port | 8080 | `--port 8081` |\n| `--interface` | Network interface | localhost | `--interface 0.0.0.0` |\n| `--domains` | Allowed domains | * | `--domains api1.com,api2.com` |\n| `--timeout` | Client timeout | 15 | `--timeout 30` |\n| `--cache-size` | LRU cache size | 100 | `--cache-size 1000` |\n| `--version` | Show version info | false | `--version` |\n\n### Monitoring\n\nCorsair exposes Prometheus metrics at `/metrics` including:\n\n- `corsair_requests_total`: Total number of processed requests\n- `corsair_request_duration_seconds`: Request duration histogram\n- `corsair_cache_hits_total`: Cache hit count\n- `corsair_cache_misses_total`: Cache miss count\n\n### Troubleshooting\n\n#### Common Issues\n\n1. **Connection Refused**\n   - Check if the port is already in use\n   - Verify firewall settings\n   - Ensure correct interface binding\n\n2. **Domain Not Allowed**\n   - Check `CORSAIR_DOMAINS` configuration\n   - Verify target URL format\n\n3. **Timeout Errors**\n   - Increase `CORSAIR_TIMEOUT` value\n   - Check target API responsiveness\n\n#### Debug Logging\n\nRun with environment variable `DEBUG=1` for verbose logging:\n\n```sh\nDEBUG=1 ./corsair\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Built with [Go](https://golang.org/)\n- Uses [hashicorp/golang-lru](https://github.com/hashicorp/golang-lru) for caching\n- Metrics powered by [Prometheus](https://prometheus.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctoth%2Fcorsair","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctoth%2Fcorsair","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctoth%2Fcorsair/lists"}