A Flask-based reverse proxy server for routing to sub-Flask apps
Project description
Flask Gateway
Flask Gateway is a lightweight Flask-based reverse proxy server that lets you host multiple independent Flask services under distinct path prefixes. I've found it useful for serving multiple local tools through a single public endpoint (e.g., via ngrok) by acting as a gateway.
🚀 Installation
You can install Flask Gateway directly from PyPI:
pip install flask-gateway
Alternatively, you can download a release archive and install it manually:
pip install flask-gateway-x.y.z.tar.gz
Or install from source:
git clone https://github.com/yourusername/flask-gateway.git
cd flask-gateway
pip install .
🧭 Usage
🔌 Start the gateway server
flask-gateway serve --port 9999 --targets examples/targets.json
- The
targets.jsonfile defines which local Flask apps are proxied and where they are routed. - Example format:
{
"myapp": {
"label": "My App",
"pathPrefix": "/myapp",
"target": "http://127.0.0.1:5001"
},
...
}
🛠️ Making your Flask apps gateway-compatible
To support routing under a path prefix (e.g., /myapp/) without breaking standalone usage, add this snippet:
try:
from flask_gateway.patch import gateway_patch
app = gateway_patch(app)
except ImportError:
pass # fallback for standalone usage
✅ This ensures your app works both as:
- A standalone Flask server (
python app.py) - A proxied service under a path like
/myapp/via Flask Gateway
📁 Example Services
See the examples/ directory for sample Flask apps you can proxy through the gateway.
To run them:
python examples/someapp/app.py
Then launch the gateway with:
flask-gateway serve --targets examples/targets.json
Visit:
http://localhost:9999/someapp/
📄 License
MIT © Adil Rahman
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
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 flask_gateway-0.1.0a0.tar.gz.
File metadata
- Download URL: flask_gateway-0.1.0a0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e4a902afee01584488fbe2b843f8d3e3fee976e5e77f80eb3900e9dc13eb209
|
|
| MD5 |
e02a3e8136347f3af07a50bd8b48be9e
|
|
| BLAKE2b-256 |
6e16352e3a3e1737d21772cbbedf692d23288249828fd49347954a7f79ebfc63
|
File details
Details for the file flask_gateway-0.1.0a0-py3-none-any.whl.
File metadata
- Download URL: flask_gateway-0.1.0a0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc3f3d0638d1718796a6f18a5052036f9e8966c83545bc5dc10d47e9945848ae
|
|
| MD5 |
021dee9807f6a861813fa5412e3c26e4
|
|
| BLAKE2b-256 |
17d531370e30e0245beebe317c665bf56e2b1a035704045c5ed1b92f65d2f56d
|