Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 32 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
<img src=".github/img/splash.jpeg">

<br/>
# `magic-proxy`

[![CI/CD](https://github.com/stonegray/magic-proxy/actions/workflows/ci.yml/badge.svg)](https://github.com/stonegray/magic-proxy/actions/workflows/ci.yml)

magic-proxy automatically configures your proxy by reading `x-magic-proxy-descriptor` fields embedded in docker compose files, allowing you to simply bring the compose up and trust that your proxy will automatically configure itself without user intervention.
magic-proxy automatically configures your web proxy by reading `x-magic-proxy` fields embedded in docker compose files, allowing you to simply bring the compose up and trust that your proxy will automatically configure itself without user intervention. It is essentially a templating engine that uses a common syntax, allowing it to generate output for various proxies.

magic-proxy attaches event-based watchers to relavant files and passively streams events from your `docker.sock` to ensure near-instant configuration of your proxy when it changes, without any polling overhead.
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: "relavant" should be "relevant"

Suggested change
magic-proxy attaches event-based watchers to relavant files and passively streams events from your `docker.sock` to ensure near-instant configuration of your proxy when it changes, without any polling overhead.
magic-proxy attaches event-based watchers to relevant files and passively streams events from your `docker.sock` to ensure near-instant configuration of your proxy when it changes, without any polling overhead.

Copilot uses AI. Check for mistakes.

magic-proxy passively streams events from your `docker.sock` to ensure near-instant configuration of your proxy, without any polling overhead.
Features:

magic-proxy is proxy-agnostic and user extensible. It contains a built in HTTP server for status reporting; which is read only and isolated in a v8 VM with a well defined abstraction layer to reduce attack surface.
- API for status monitoring
- Hundreds of built-in regression tests to ensure future stability
- Runtime tests to validate your configuration

magic-proxy is currently in development.
Limitations:
- Only one port per container.
- Currently only the Traefik backend is implemented. You may try the Nginx branch at your own risk.

Example:

```yaml
version: "3.9"

services:
web-test1:
image: crccheck/hello-world
container_name: web-test1
expose:
- "8000"
x-magic-proxy-descriptor:
x-magic-proxy:
# read ./config/template/* to see how these work, but basically it's
# the base config that gets permutated for each container:
template: example.yml
# base information to pass to the proxy:
hostname: web-test1.proxy.example.org
target: http://web-test1:8000
userData:
# add anything here; like OIDC/Oauth2 roles/groups
# this data can get passed to any configuration parameter
# on the proxy:
oidc_group: superCoolPeople
rateLimit: 10
```

Now visiting web-test1.proxy.example.org transparently forwards to
Now visiting web-test1.proxy.example.org transparently forwards to port 8000 in the container.

## Usage:
Simply start the container on your host and specify the name of the proxy container.
Expand All @@ -38,25 +50,23 @@ services:
magic-proxy:
build: .
image: docker-ts-app:latest
enviroment:
- PROXY_TYPE="traefik"
- PROXY_OUTPUT_FILE="traefik"
volumes:
- "traefik_magic.yml:/var/traefik_magic.yml"
- "/var/run/docker.sock:/var/run/docker.sock"
- "./config:/var/config:ro"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "generated_config:/var/generated"
- "/:/host:ro" # required to read the compose files
restart: unless-stopped
traefik:
image: "traefik:v3.4"
container_name: "traefik"
restart: unless-stopped
security_opt:
- no-new-privileges:true
command:
- "--entryPoints.web.address=:80"
- "--configFile:/var/generated/traefik_magic.yml"
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing colon after "--configFile" parameter. The correct syntax should be "--configFile=/var/generated/traefik_magic.yml" (with equals sign) or "--configFile:/var/generated/traefik_magic.yml" should be corrected to use the proper Traefik flag format.

Suggested change
- "--configFile:/var/generated/traefik_magic.yml"
- "--configFile=/var/generated/traefik_magic.yml"

Copilot uses AI. Check for mistakes.

ports:
- "80:80"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "generated_config:/var/generated:ro"
```

## Why?
Comment on lines +69 to +71
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docker-compose.yml file is incomplete - it's missing the closing volumes declaration and the "Why?" section on line 71 appears to be cut off with no content. The file should either include the complete docker-compose.yml example or indicate that it continues.

Copilot uses AI. Check for mistakes.

```
34 changes: 0 additions & 34 deletions test-env/docker-compose.yml

This file was deleted.

Loading