Reverse Proxy for Django
FlipFlop is a flexible and customizable reverse proxy library for Django web applications. It allows you to easily create a reverse proxy server that can handle incoming requests and forward them to backend servers, performing various actions and modifications along the way using plugins.
-
Create a Django project or use an existing one.
-
Create your custom plugin classes by deriving them from the
FlipFlopPluginbase class. You can implement various methods to process request headers, response content, and control streaming behavior. -
Instantiate a
FlipFlopProxyHandlerobject in your Django view, passing it aFlipFlopConfigobject that specifies the source and target URLs, and any desired plugins. -
Call the
handle_requestmethod on theFlipFlopProxyHandlerobject in your Django view to process incoming requests and forward them to the backend server.
You can create your own custom plugins by deriving them from the FlipFlopPlugin base class. Implement the necessary methods to control the behavior of your plugin. The plugin architecture allows you to modify request headers, process response content, and control streaming behavior.
FlipFlop comes with a test suite that includes unit tests for various components of the library. You can run the tests using the following command:
python -m unittest discover tests