borah / cors-proxy
Bypass CORS issues when developing locally with no hassle.
Requires
- php: ^8.1
- amphp/amp: ^3.0
- amphp/http: ^2.1
- amphp/http-server: ^3.3
- amphp/http-server-form-parser: ^2.0
- amphp/http-server-router: ^2.0
- amphp/log: ^2.0
- guzzlehttp/guzzle: ^7.5
- illuminate/http: ^10.0
- nunomaduro/termwind: ^1.15.1
- revolt/event-loop: ^1.0
Requires (Dev)
- laravel-zero/framework: ^10.2
- laravel/pint: ^1.13
- mockery/mockery: ^1.6
- pestphp/pest: ^2.22
README
CORS Proxy is a CLI tool based on Laravel Zero and it's extremely useful to remove all the CORS errors you might have when developing locally.
Why
Unfortunately we don't always have the luxury of having access to the back-end or the ability to change the CORS headers. This tool will help you to bypass that issue.
Requirements
To use CORS Proxy, you need to have PHP 8.1+ installed on your computer. Also, you need to have Composer installed.
Installation
To install CORS Proxy, you need to run the following command:
composer global require borah/cors-proxy
Usage
The usage is pretty simple. This is the command structure:
cors-proxy <host> {--headers=} {--port=1337}
The host
argument is the URL of the host you want to proxy. The --headers
option should be a JSON with default headers to send in all requests. The --port
option is used to specify the port you want to use for the proxy server.
Example
cors-proxy "https://httpbin.org"
This command will start the proxy server on port 1337 and will proxy all requests to https://httpbin.org
.
curl -X GET "http://localhost:1337/get?foo=bar&baz=qux" -H "x-custom-header: custom value"