Skip to content
/ portal Public
forked from xuchao-ovo/portal

Expose your local web server to the internet with a public URL.

License

Notifications You must be signed in to change notification settings

efanwcy/portal

 
 

Repository files navigation

portal

portal lets you expose your locally running web server via a public URL. Written in Rust. Built completely with async-io on top of tokio.

  1. Install
  2. Usage Instructions
  3. Host it yourself

Install

Cargo

cargo install portal

Everywhere

Or Download a release for your target OS here: portal/releases

Usage

Quick Start

portal --port 8000

The above command opens a tunnel and forwards traffic to localhost:8000.

More Options:

Expose your local web server to the Internet with a public url.

Usage: portal [OPTIONS] [COMMAND]

Commands:
  set-auth  Store the API Authentication key
  help      Print this message or the help of the given subcommand(s)

Options:
  -v, --verbose
          A level of verbosity, and can be used multiple times
  -k, --key <KEY>
          Sets an API authentication key to use for this portal
  -s, --sub-domain <SUB_DOMAIN>
          Specify a sub-domain for this portal
      --host <LOCAL_HOST>
          Sets the HOST (i.e. localhost) to forward incoming portal traffic to [default: localhost]
  -t, --use-tls
          Sets the protocol for local forwarding (i.e. https://localhost) to forward incoming portal traffic to
  -p, --port <PORT>
          Sets the port to forward incoming portal traffic to on the target host [default: 8000]
      --dashboard-port <DASHBOARD_PORT>
          Sets the address of the local introspection dashboard
  -h, --help
          Print help
  -V, --version
          Print version

Host it yourself

  1. Compile the server for the musl target. See the musl_build.sh for a way to do this trivially with Docker!
  2. See Dockerfile for a simple alpine based image that runs that server binary.
  3. Deploy the image where ever you want.

Testing Locally

# Run the Server: xpects TCP traffic on 8080 and control websockets on 5000
ALLOWED_HOSTS="localhost" cargo run --bin portal_server

# Run a local portal client talking to your local portal_server
CTRL_HOST="localhost" CTRL_PORT=5000 CTRL_TLS_OFF=1 cargo run --bin portal -- -p 8000

# Test it out!
# Remember 8080 is our local portal TCP server
curl -H 'Host: <subdomain>.localhost' "http://localhost:8080/some_path?with=somequery"

See portal_server/src/config.rs for the environment variables for configuration.

About

Expose your local web server to the internet with a public URL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 90.5%
  • HTML 9.2%
  • Other 0.3%