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
- has minimal support for the following features:
- Caching
- current features:
- bypass rules (partially supported, see tests + RFC for more) from requests or response and
Cache-Controldirectives - 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)
- bypass rules (partially supported, see tests + RFC for more) from requests or response and
- enhancements:
- ETag (full support)
Last-Modified/ExpiresIf-None-Match/If-Match- Fresh/Stale using
Ageormax-age - Validation mechanism
- current features:
- Static configuration
- => need to refactor the
Proxystruct
- => need to refactor the
- 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: