Skip to content

Commit

Permalink
Finalise 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Bassetts committed May 17, 2020
1 parent 43caaa7 commit 07d98cd
Showing 1 changed file with 35 additions and 24 deletions.
59 changes: 35 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## warp-cors
# warp-cors

[![ci](https://github.com/Bassetts/warp-cors/workflows/ci/badge.svg)](https://github.com/Bassetts/warp-cors/actions?query=workflow%3Aci)
[![GitHub](https://img.shields.io/github/license/bassetts/warp-cors?color=blue)](./LICENSE)
Expand All @@ -10,43 +10,54 @@ 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
have any origin allowed and allow all headers in the request to be exposed in the
reponse.

### Usage
## Installation

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.
### Binaries

If you are running warp-cors on a pubicly accessible hostname it is
recommended to set the `--hostname` flag to match.
[Archives of precompiled binaries](https://github.com/Bassetts/warp-cors/releases)
are available for Linux, macOS, and Windows.

#### Running with `cargo`
The Windows binaries require [Microsoft Visual C++ 2015 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=53587)
to be installed.

```shell
# Run warp-cors with default options
$ cargo run
### Cargo

# Pass flags to override the defaults
$ cargo run -- --port 3000
The minimum supported Rust version is **1.39.0**, warp-cors will not work with
versions lower than this.

# View help message
$ cargo run -- --help
```shell
$ cargo install warp-cors
```

#### Installing with `cargo`
### Docker

Docker images are published in the
[bassetts/warp-cors](https://hub.docker.com/repository/docker/bassetts/warp-cors)
repository.

```shell
# Install
$ cargo install --path .
$ docker run -dp 3030:3030 bassetts/warp-cors
```

# Run
$ warp-cors
## Usage

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.

#### Example
```shell
$ warp-cors --port 3000 --hostname cors.example.org
```

### Example requests
## Example requests

```shell
http://localhost:3030/ # 404 Not Found
Expand All @@ -56,7 +67,7 @@ http://localhost:3030/example.org # 404 Not Found (no scheme provided)
http://localhost:3030/ftp://example.org # 404 Not Found (invalid scheme provided)
```

### Logging
## Logging

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
Expand Down

0 comments on commit 07d98cd

Please sign in to comment.