https://github.com/donutloop/httpcache
An HTTP server that proxies all requests to other HTTP servers and this servers caches all incoming responses objects
https://github.com/donutloop/httpcache
cache http webservice
Last synced: 13 days ago
JSON representation
An HTTP server that proxies all requests to other HTTP servers and this servers caches all incoming responses objects
- Host: GitHub
- URL: https://github.com/donutloop/httpcache
- Owner: donutloop
- License: mit
- Created: 2018-05-26T11:25:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-06T11:58:33.000Z (about 7 years ago)
- Last Synced: 2024-06-20T12:48:54.442Z (over 1 year ago)
- Topics: cache, http, webservice
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 24
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# httpcache
[](https://travis-ci.org/donutloop/httpcache)
[](https://coveralls.io/github/donutloop/httpcache)
An HTTP server that proxies all requests to other HTTP servers and this servers caches all incoming responses objects
## Backend Requirements
* [golang](https://golang.org/) - The Go Programming Language
* [docker](https://www.docker.com/) - Build, Manage and Secure Your Apps Anywhere. Your Way.
## Prepare GO development environment
Follow [install guide](https://golang.org/doc/install) to install golang.
## Build without docker
```bash
mkdir -p $GOPATH/src/github.com/donutloop/ && cd $GOPATH/src/github.com/donutloop/
git clone git@github.com:donutloop/httpcache.git
cd httpcache
go build ./cmd/httpcache
```
## Build with docker
```bash
mkdir -p $GOPATH/src/github.com/donutloop/ && cd $GOPATH/src/github.com/donutloop/
git clone git@github.com:donutloop/httpcache.git
docker build .
```
## Usage
```bash
USAGE
httpcache [flags]
FLAGS
-cap 100 capacity of cache
-cert server.crt TLS certificate
-expire 5 the items in the cache expire after or expire never
-http :80 serve HTTP on this address (optional)
-key server.key TLS key
-rbcl 524288000 response size limit
-tls serve TLS on this address (optional)
```
## Usage of cache from outside (GO Example)
```golang
...
transport := &http.Transport{
Proxy: SetProxyURL(proxyServer.URL), // Set url of http cache
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
client = &http.Client{
Transport: transport,
}
client.Do(req)
...
```
## Run container
It's expose port 8000 and run a spefici container by id
```bash
sudo docker run -p 8000:8000 {{container_id}}
```