Skip to content

Instantly share code, notes, and snippets.

@briceburg
Last active November 21, 2024 15:31
Show Gist options
  • Save briceburg/20c90e127b41d8d92ba7fe2f6a745965 to your computer and use it in GitHub Desktop.
Save briceburg/20c90e127b41d8d92ba7fe2f6a745965 to your computer and use it in GitHub Desktop.
Demonstrate placing mitmproxy in front of a service in docker compose
services:
proxy:
image: mitmproxy/mitmproxy:11.0
tty: true
ports:
- "80:8080" # proxy
- "8081:8081" # web ui
command: mitmweb --mode reverse:http://backend:3000/ --web-host 0.0.0.0 --set keep_host_header --no-web-open-browser
depends_on:
- backend
backend:
image: hashicorp/http-echo:1.0
command: ['-listen', ':3000', '-text', 'Hello from ${APP_NAME:-backend}!']
# compose up
# curl localhost
# curl localhost/foo
# open http://localhost:8081/ in your browser to see the requests/responses from the ^^^ curl commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment