Edge/IoT adaptive reverse proxy with policy routing, caching, and offline-aware fallback.
Project description
edge-proxy-py
edge-proxy-py is a lightweight reverse proxy designed for edge / IoT deployments.
Focus:
- offline/unstable network conditions
- routing policies (geo/device/priority)
- local cache fallback
- health checks and telemetry
Features
- Reverse proxy gateway for edge services
- Policy-based routing (device-id header / path rules)
- Concurrent backend health checking with connection pooling
- In-memory cache fallback for GET requests (TTL-based with LRU-like eviction)
- Prometheus metrics (request count, cache hits/misses, backend health)
- Graceful shutdown (SIGINT/SIGTERM)
Quickstart
Install
pip install edge-proxy-py
Run
edge-proxy run -c examples/config.yml
Test
curl -H "X-Device-ID: sensor-1" http://localhost:9100/api/data
Architecture
Client ──► edge-proxy ──► Route matching (path_prefix / device_id)
│
┌────▼────┐
│ Cache │──► Return cached response (GET only)
└────┬────┘
│ miss
┌────▼────┐
│ Backend │──► forward() via httpx connection pool
└────┬────┘
▼
Upstream server
Changelog
0.1.1
- Connection pooling: Shared
httpx.AsyncClientsingleton for proxy and healthcheck (was creating a client per request/check). - Concurrent health checks: Backends checked in parallel via
asyncio.gather(was sequential). - Graceful shutdown: Signal handlers (SIGINT/SIGTERM) cancel healthcheck loop and close clients cleanly.
- Logging: Added structured
loggingthroughout;--log-levelCLI option. - Bare except fixes: All
except Exceptionblocks re-raiseasyncio.CancelledError. - Build system: Migrated from
setuptoolstohatchling. Added classifiers, keywords, optional dev/test deps, ruff/pytest config. - Tests: Expanded from 1 test to 15+ tests covering config, router, cache, proxy, healthcheck, and backends.
- CI: Added GitHub Actions workflow (ruff + pytest on 3.10–3.12).
0.1.0
- Initial release: Reverse proxy, policy-based routing, cache fallback, health checks, Prometheus metrics.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
edge_proxy_py-0.1.1.tar.gz
(9.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file edge_proxy_py-0.1.1.tar.gz.
File metadata
- Download URL: edge_proxy_py-0.1.1.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ade6fa626c781f5b994ee0ab6e1c2099b03b17861b6d9c9caaa561984be2346
|
|
| MD5 |
2562f485b152b2242a81025068af150a
|
|
| BLAKE2b-256 |
f0ebebd1036c67f562a963734d005620d1bc7a57007ad43129ea4c6745393d32
|
File details
Details for the file edge_proxy_py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: edge_proxy_py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f388d76b4fe9f55352ceee6fc9589a1d4fb1077a84b30e54a7bc49d1ebaf2e4e
|
|
| MD5 |
1c8d614bde0023853d20ef61c68fbc66
|
|
| BLAKE2b-256 |
712da58a94b6eb0d8899c4af6c446984a6bb61ed232f9a2fcc88564fd5ecc9e5
|