https://github.com/breuerfelix/httproxy-cache
HTTP Reverse Proxy Cache
https://github.com/breuerfelix/httproxy-cache
cache http proxy reverse-proxy
Last synced: 10 months ago
JSON representation
HTTP Reverse Proxy Cache
- Host: GitHub
- URL: https://github.com/breuerfelix/httproxy-cache
- Owner: breuerfelix
- Created: 2024-02-18T15:32:43.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-13T13:09:30.000Z (about 1 year ago)
- Last Synced: 2025-04-04T12:28:02.997Z (12 months ago)
- Topics: cache, http, proxy, reverse-proxy
- Language: Go
- Homepage:
- Size: 32.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTTProxy Cache
Example config found [here](config.yaml):
```yaml
upstream: "https://httpbin.org"
routes:
- path: "/anything/:param1"
clear_cache:
- DELETE
- POST
```
## How it works
The service has a catch-all route that proxies ALL requests to the specified upstream.
`GET` routes defined in the `config.yamL` are cached in memory. The first request is made against upstream and all future ones are served out of memory.
A `HEAD` request against the route will clear the cache.
Request methods defined in `clear_cache` will also clear it.
Example:
1. `GET /anything/foobar` -> proxied, saved in memory
1. `GET /anything/foobar` -> served from cache
1. `POST /anything/foobar` -> proxied, clears cache
1. `GET /anything/foobar` -> proxied, saved in memory