Reverse proxy for local development with Docker or Podman
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
To use this project you need to have Docker or Podman installed. No other dependencies are required.
You can download the script and run it from there. Alternatively you can clone the repository and run the script from there
curl -O https://raw.githubusercontent.com/dontfreakout/dev-proxy/master/start-proxy.shchmod +x start-proxy.shfor example:
mv start-proxy.sh ~/.local/bin/dev-proxyYou have to configure the containers you want to proxy in the docker-compose.yml file.
You need to add the hostname, port and protocol to the environment variables of the container.
Also, you need to add the container and the service to the proxy network.
Example configuration:
services:
my-service:
networks:
proxy:
environment:
VIRTUAL_HOST: example.localhost
VIRTUAL_PORT: 80 # port of the service
VIRTUAL_PROTO: http # (valid options are https or http) if using https, you probably want to use VIRTUAL_PORT: 443
networks:
proxy:
name: proxy_network # name of the proxy network needs to be the same as in the scriptIf you want to use multiple domains on one service you can separate them with a comma.
VIRTUAL_HOST: example.localhost,example2.localhostYou can run the script using the following command. This will download docker image and start the proxy with default settings.
./start-proxy.shAfter starting the proxy, you can open the localhost page in your browser to see all available vhosts.
(Note: If you are using a different port for the proxy, you need to change the URL accordingly, e.g. https://localhost:8443)
Usage: ./start-proxy.sh [options] [command]
| Command | Description |
|---|---|
list |
List currently available vhost urls |
stop |
Stop the proxy |
update |
Update proxy container |
uninstall |
Remove the proxy container and network |
The proxy is by default available to local machine on port 80 and 443. You can change this with parameters.
./start-proxy.sh -s 8443 -i 8080| Option | Description | Default value |
|---|---|---|
-s, --secure |
Port for https | 443 for docker, 8443 for rootless podman |
-i, --insecure |
Port for http | 80 for docker, 8080 for rootless podman |
-n, --network |
Name of the proxy network | proxy_network |
-c, --container |
Name of the proxy container | dev-proxy |
-h, --help |
Show help | |
-v, --version |
Show version |
The proxy uses a self-signed certificate. To add it to your browser and get rid of the warning you need to import the root certificate. You can follow the steps below to import the certificate.
- Open Chrome and go to
chrome://settings/certificates - Click on
Authoritiestab - Click on
Import - Select Root certificate from config folder
- Linux:
~/.config/dev-proxy/certs/rootCA.crt - MacOS:
~/Library/Application Support/dev-proxy/certs/rootCA.crtor~/.config/dev-proxy/certs/rootCA.crt
- Linux:
- Click on
Trust this certificate for identifying websites - Click on
OK
- Open Firefox and go to
about:preferences#privacy - Scroll down and click on
View Certificates - Click on
Authorities - Click on
Import - Select Root certificate from config folder
- Linux:
~/.config/dev-proxy/certs/rootCA.crt - MacOS:
~/Library/Application Support/dev-proxy/certs/rootCA.crtor~/.config/dev-proxy/certs/rootCA.crt
- Linux:
- Click on
OK
- add option to install as docker service
- possibility to install certificate system-wide
- check for new version and self update
See the open issues for a list of proposed features (and known issues).
See CHANGELOG.md for more information on what has changed recently.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
This project uses GitHub Actions to automatically build and deploy Docker images to GitHub Container Registry (ghcr.io) when a new git tag is created.
- Update the version in the Dockerfile (
LABEL version="x.y.z") - Commit and push your changes
- Create and push a new git tag:
git tag v1.2.10 git push origin v1.2.10
- The GitHub workflow will automatically build the Docker image for both amd64 and arm64 architectures and push it to ghcr.io with the tag matching the git tag.
You can also build the image manually using the Makefile:
make buildOr build without caching:
make build-ncDistributed under the MIT License. See LICENSE for more information.