warp-cors is a proxy server which enables CORS for the proxied request.
The path of the request is validated and then used as the url to proxy. Only http and https protocols are allowed and must be specified.
Preflight requests will allow any methods and headers. All proxied requests will have any origin allowed and allow all headers in the request to be expose in the reponse.
By default warp-cors will listen on port 3030
and use the package name
(warp-cors
) as the pseudonym in the Via
header sent with the proxied
request. These can be overwritten by using the --port <PORT>
and
--hostname <HOST>
flags respectively.
If you are running warp-cors on a pubicly accessible hostname it is
recommended to set the --hostname
flag to match.
cargo
```shell
$ cargo run
$ cargo run -- --port 3000
$ cargo run -- --help ```
cargo
```shell
$ cargo install --path .
$ warp-cors ```
shell
http://localhost:3030/ # 404 Not Found
http://localhost:3030/http://example.org # Proxied HTTP response with CORS headers
http://localhost:3030/https://example.org # Proxied HTTPS response with CORS headers
http://localhost:3030/example.org # 404 Not Found (no scheme provided)
http://localhost:3030/ftp://example.org # 404 Not Found (invalid scheme provided)
warp-cors uses [pretty_env_logger
], so you can control log levels by setting
the RUST_LOG
environment variable. This is useful for both developing and
for running warp-cors.
```shell
$ RUST_LOG=info warp-cors
$ RUSTLOG=warpcors=info warp-cors
$ RUSTLOG=warpcors::filters::request=trace warp-cors ```