GithubHelp home page GithubHelp logo

7a6163 / warp-cors Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bassetts/warp-cors

0.0 0.0 0.0 65 KB

warp-cors is a proxy server which enables CORS for the proxied request

License: MIT License

Rust 98.28% Dockerfile 1.72%

warp-cors's Introduction

warp-cors

ci GitHub Crates.io

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 exposed in the reponse.

Installation

Binaries

Archives of precompiled binaries are available for Linux, macOS, and Windows.

The Windows binaries require Microsoft Visual C++ 2015 Redistributable to be installed.

Cargo

The minimum supported Rust version is 1.56.0, warp-cors will not work with versions lower than this.

$ cargo install warp-cors

Docker

Docker images are published in the bassetts/warp-cors repository.

$ docker run -dp 3030:3030 7a6163/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

$ warp-cors --port 3000 --hostname cors.example.org

Example requests

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)

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 for running warp-cors.

# Output all info level logs, including those from libraries used by warp-cors
$ RUST_LOG=info warp-cors

# Output info level logs for only warp-cors
$ RUST_LOG=warp_cors=info warp-cors

# Filter logging by module, useful for development or debugging
$ RUST_LOG=warp_cors::filters::request=trace warp-cors

warp-cors's People

Contributors

bassetts avatar 7a6163 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.