Http features

Expose http server

Install source code

In order to use the http tunnel feature, you will first need to download it's source code. The following command takes care of that.

stew tunnel:install

Open an http tunnel

Steward allows to open a tunnel to your local http server. You will get a random url similar tohttps://example.tunnel.stew.sh/, which will be accessible from outside your local network. This way you can temporarily have a client or co-worker visit your local site without having to upload or deploy any code.

Make sure to download the required source code using stew tunnel:install

stew http:expose example.test

You can pass the --jail-redirects option to have steward jail all redirects within the chosen host. This can come in very handy when your application keeps sending 301 responses containing the location header to it's original hostname.

To specify a specific local port, e.g. 8080, you can add the option like ---port 8080. The --handle option allows you to use any specific subdomain you would like, as long as it is available at that moment.

stew http:expose example.test --handle example --port 8080 --jail-redirects

The command above will start listening for requests to the url https://example.tunnel.stew.sh and forward these requests to your local webserver with host header "example.test", on port 8080.

Use --tmux to open the webserver in a tmux session and/or add --daemonize to send the process to the background.

Uninstall source code

To remove the http tunnel source code, use the following command.

stew tunnel:uninstall

Self-signed trusted SSL

You can create a self-signed certificate for a specific domain and add it to your keychain's trusted SSL certificates using the following command.

stew http:secure example.test

Revoke self-signed SSL

You can also remove or revoke a local site's ssl certificates by using the following command.

stew http:unsecure example.test

Php built-in web server

You can quickly start php's built-in webserver using the following command. Use --document-root= and --port= to specify another document root (default current working directory) or port (default 8080). Use the --expose option to immediately open a tunnel as well and get a public url.

You can use --tmux to open the webserver in a tmux session and/or add --daemonize to send the process to the background.

stew http:serve

Managing daemons

Steward uses tmux to manage background processes and allow easy access to their output. The same goes for the built-in webserver. You can kill the background process for the built-in web server as follows.

tmux kill-session -t serve

The background process for the http tunnel can be killed as follows.

tmux kill-session -t expose

Quick start example

Steward allows you to launch and expose a webserver publicly, probably faster than you can imagine. Try the following steps and see for yourself.

# Clone any (dummy) repo, below is an example.
git clone https://github.com/alpacash/dummy-site.git /tmp/dummysite
‚Äč
# Serve and expose the site in /tmp/dummysite
stew http:serve -d /tmp/dummysite --expose