A simple HTTP Reverse Proxy with caching.
This is a small challenge for building a reverse proxy from scratch in Go.
Warning
This work is far from being perfect.
It works but might not be fully compatible to HTTP standards on caching and other details.
Here are the main goals of the project. It may evolve across the project's lifetime.
- HTTP reverse proxy
- has minimal support for the following features:
- all HTTP methods
- forwarded headers (X-Forwarded-*)
- streaming data
- trailer headers
- middlewares (custom or predefined, to extend the proxy behaviour)
- enhancements:
- support for more protocols (websocket, tcp, udp, HTTP/2, HTTP/3)
- enhance the routing engine
- entrypoints/middlewares/servers architecture
- Caching
- current features:
- bypass rules (partially supported, see tests + RFC for more) from requests or response and Cache-Control directives
- cache response from method and status code (heuristical caching)
- adapter pattern to add any cache implementation in the proxy (in-memory, redis, ...)
- ETag (partially supported)
- enhancements:
- ETag (full support)
- Last-Modified / Expires
- If-None-Match / If-Match
- Fresh/Stale using Age or max-age
- Validation mechanism
- Static configuration
- => need to refactor the Proxy struct
- CLI
- minimal version for now.
- can be enhanced with config management + other flags for configuring the app
- Load balancing
- would have to create a proper router between endpoints and servers
- Authentication
- Rate limit
- Observability
These could be implemented using middlewares.
Some ressources I found useful referencing to: