An open API service indexing awesome lists of open source software.

https://github.com/j-jagger/tinyrp

Pythonic Async-focused Reverse Proxy
https://github.com/j-jagger/tinyrp

flask nginx prototype python quart reverseproxy

Last synced: 3 months ago
JSON representation

Pythonic Async-focused Reverse Proxy

Awesome Lists containing this project

README

          

# TinyRP

Tiny Reverse Proxy, built in Asynchronous Python.
### Project State: INDEV

[![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html/)

## Features

- Simple Configuration
- Low Runtime Footprint (Highly debatable, however)
- Fully asynchronous operations
- Insanely easy route setup

## Disclaimers

This has not been tested as thoroughly as it should've been. It is also very much not finished! While in theory, it may seem fairly safe to be thrown into the harsh winds of the internet, in practice, I would imagine any experienced bad actor could find some sort of crack in the url system.

Spotted something I could improve? Leave an issue!

## How does it work?

Firstly, on boot, a file named 'settings.tiny' is read from. It's called .tiny, because it's fairly small.

Example settings.tiny:

```
# Routes + Options File for TinyRP v1.0.0
# Routes begin with >, Settings begin with -.

- port -> 8000
- host -> 0.0.0.0
> http://localhost:8000 -> 127.0.0.1:5500
```

Comments can be created using # or /.
As the file says, routes begin with > and settings begin with -. It follows a fairly simple 'structure' wherein, quite simply, 'key -> value'.

After the settings and routes are registered, the Quart-Uvicorn ASGI server starts. It runs a route on ``/`` and ``/``.

When a user sends a request, the server checks if their host is inside the routes dictionary, and resolves it to a url. From there, it uses aiohttp to get the url using the exact(ish) same details as the client gave to the server. It then responds to the client's request with whatever the url responds with.