fabiocicerchia / go-proxy-cache

Simple Reverse Proxy with Caching, written in Go, using Redis.
Other
133 stars 18 forks source link
cache golang proxy-server redis

Go Proxy Cache

![Logo](https://github.com/fabiocicerchia/go-proxy-cache/raw/main/docs/assets/logo_small.png) Simple Reverse Proxy with Caching, written in Go, using Redis. >>> **(semi) production-ready** <<< [![MIT License](https://img.shields.io/badge/License-MIT-brightgreen.svg?longCache=true)](LICENSE) [![Pull Requests](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?longCache=true)](https://github.com/fabiocicerchia/go-proxy-cache/pulls) ![Maintenance](https://img.shields.io/maintenance/yes/2023) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) ![Last Commit](https://img.shields.io/github/last-commit/fabiocicerchia/go-proxy-cache) ![Release Date](https://img.shields.io/github/release-date/fabiocicerchia/go-proxy-cache) ![GitHub all releases](https://img.shields.io/github/downloads/fabiocicerchia/go-proxy-cache/total) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/fabiocicerchia/go-proxy-cache) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/fabiocicerchia/go-proxy-cache) ![Docker pulls](https://img.shields.io/docker/pulls/fabiocicerchia/go-proxy-cache "Docker pulls") ![Docker stars](https://img.shields.io/docker/stars/fabiocicerchia/go-proxy-cache "Docker stars") ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/fabiocicerchia/go-proxy-cache/Builds) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4469/badge)](https://bestpractices.coreinfrastructure.org/projects/4469) [![BCH compliance](https://bettercodehub.com/edge/badge/fabiocicerchia/go-proxy-cache?branch=main)](https://bettercodehub.com/results/fabiocicerchia/go-proxy-cache) [![Go Report Card](https://goreportcard.com/badge/github.com/fabiocicerchia/go-proxy-cache)](https://goreportcard.com/report/github.com/fabiocicerchia/go-proxy-cache) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ffabiocicerchia%2Fgo-proxy-cache.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ffabiocicerchia%2Fgo-proxy-cache?ref=badge_shield) [![codecov](https://codecov.io/gh/fabiocicerchia/go-proxy-cache/branch/main/graph/badge.svg)](https://codecov.io/gh/fabiocicerchia/go-proxy-cache) [![Maintainability](https://img.shields.io/codeclimate/maintainability/fabiocicerchia/go-proxy-cache)](https://codeclimate.com/github/fabiocicerchia/go-proxy-cache/maintainability) [![Technical Debt](https://img.shields.io/codeclimate/tech-debt/fabiocicerchia/go-proxy-cache)](https://codeclimate.com/github/fabiocicerchia/go-proxy-cache/maintainability) [![Total alerts](https://img.shields.io/lgtm/alerts/g/fabiocicerchia/go-proxy-cache.svg)](https://lgtm.com/projects/g/fabiocicerchia/go-proxy-cache/alerts/)

💗 Support the Project 💗

This project is only maintained by one person, Fabio Cicerchia.
It started as a simple caching service, now it has a lot of pro functionalities just for FREE 😎
Maintaining a project is a very time consuming activity, especially when done alone 💪 I really want to make this project better and become super cool 🚀

Two commercial versions have been planned: PRO and PREMIUM.

The development of the COMMUNITY version will continue, but priority will be given to the COMMERCIAL versions.


How it works

When the request is cached:

        .---------.       .---------.       .---------.
        |         |       |         |       |         |
        |         |       |         |       |         |
you --->|---->----|--->---|---->----|--->---|-->--.   |
        |         |       |         |       |     |   |
    <---|----<----|---<---|----<----|---<---|--<--'   |
        `---------´       `---------´       `---------´
          network        go-proxy-cache        redis

When the request is not cached:

          website
            ,_,
            | |
        .---+-+---.       .---------.       .---------.
        |   | '-->|--->---|---->----|--->---|-->--,   |
        |   '-<---|---<---|<--,     |       |     |   |
        |         |       |   |     |       |     |   |
you --->|---->----|--->---|---'     |       |     |   |
        |         |       |         |       |     |   |
    <---|----<----|---<---|----<----|---<---|--<--'   |
        `---------´       `---------´       `---------´
          network        go-proxy-cache        redis

Features

Small, Pragmatic and Easy to Use

Caching

Load Balancing

Security

Reliability

Scaling

Customisations

Logging

Configuration

YAML

This is a simple (and not comprehensive) configuration:

server:
  port:
    http: "80"
    https: "443"
  tls:
    cert_file: server.pem
    key_file: server.key
  upstream:
    host: ~
    port: 443
    scheme: https
    endpoints:
      - 127.0.0.1
    http_to_https: true
    redirect_status_code: 301

cache:
  hosts: 
    - localhost:6379

domains:
  example_com:
    server:
      upstream:
        host: example.com

  example_org:
    server:
      upstream:
        host: example.org

For more details about the full server configuration check the relative documentation in docs/CONFIGURATION.md

Examples

CLI

$ go-proxy-cache -h
Usage of go-proxy-cache:
  -config string
        config file (default "config.yml")
  -debug
        enable debug
  -log string
        log file (default stdout)
  -test
        test configuration
  -verbose
        enable verbose
  -version
        display version
[...]

For examples check the relative documentation in docs/EXAMPLES.md

Release Cycle

Common Errors

References

License

OpenSSL

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)

Go Proxy Cache

MIT License

Copyright (c) 2023 Fabio Cicerchia info@fabiocicerchia.it

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

FOSSA Status