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.2.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.2.tar.gz.
File metadata
- Download URL: edge_proxy_py-0.1.2.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 |
a82005847046a774da0dbd2e6cab08c76ffadf0d1a7a7185dcc6b4433694dd2c
|
|
| MD5 |
80ca8fcfc464a527ea430ab484bc4b39
|
|
| BLAKE2b-256 |
3191cf5fc4d71dd5a0c988355b10b70481f8430e86c9cb688dd195a7a465b142
|
File details
Details for the file edge_proxy_py-0.1.2-py3-none-any.whl.
File metadata
- Download URL: edge_proxy_py-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.8 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 |
2fc9698b8fd7f3335f9207d06ec018a916e31035815c578351a1d8e7cc9b4057
|
|
| MD5 |
cf8aad2bc8f089449df33308776fc634
|
|
| BLAKE2b-256 |
154559e67fddf322aa31d59f91eba2f27050c80930fff78cf09f4ba9d2400d0a
|