This is a simple caching proxy server written in Go. It forwards requests to an origin server, caches the responses, and serves cached responses for subsequent requests.
- Forwards requests to an origin server
- Caches responses to reduce load on the origin server
- Serves cached responses for subsequent requests
- Provides an option to clear the cache
To run the caching proxy server, use the following command:
go run main.go --origin <origin_url> --port <port>--origin: The URL of the origin server to forward requests to (required).--port: The port to run the caching proxy server on (default: 3000).
Example:
go run main.go --origin http://example.com --port 3000To clear the cache, use the --clear-cache flag:
go run main.go --clear-cacheThe main components of the caching proxy server are:
ProxyHandler: Forwards requests to the origin server and caches responses.ClearCache: Clears the cached data.main: Parses command-line flags and starts the server.
This project is licensed under the MIT License.