A high performance reverse proxy written in go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
JojiiOfficial 504ad5f68e
Merge pull request #10 from JojiiOfficial/dependabot/go_modules/github.com/JojiiOfficial/gaw-1.2.8
10 months ago
kubernetes add kubernetes manifest files 1 year ago
models finally fixed routing 1 year ago
proxy finally fixed routing 1 year ago
.gitignore add kubernetes manifest files 1 year ago
Dockerfile add Dockerfile 1 year ago
LICENSE Create LICENSE 1 year ago
Main.go fix path building 1 year ago
README.md Update README.md 1 year ago
go.mod Bump github.com/JojiiOfficial/gaw from 1.2.6 to 1.2.8 10 months ago
go.sum Bump github.com/JojiiOfficial/gaw from 1.2.6 to 1.2.8 10 months ago

README.md

Reverseproxy

A high performance reverse proxy written in go. It can replace reverseproxies like apache or nginx if you don't need special features. It is pretty simple to setup, lightweight and very fast. In some cases it is faster than apache/nginx!

Installation

You can compile the binary by using go build -o main. This will create a file called main.
You can set -debug and -config if you want to view more output or specify a custom config file. By default the config file is stored at /etc/reverseproxy/config.toml

Docker

The images are hosted at Dockerhub.
To Install it, run following command

docker run --name revproxy --rm -v `pwd`/config:/app/config jojii/reverseproxy

Concept/Idea

  • You have one configfile in which you have to define your routefiles and interfaces
  • You can have n routes stored in separate files in the ./config/routes directory
  • One route represents one (sub)domain/host
  • One route can listen on n ports/interfaces which you have to specify in the config first
  • Http redirect interfaces can't be used as interface for locations

Configuration

Example

Config.toml:

# Specify your routes
RouteFiles = ["./config/routes/route1.toml"]
[Server]
  MaxHeaderSize = "16KB" # B/KB/MB/GB/TB/PB/EB
  ReadTimeout = "10s"
  WriteTimeout = "10s"
  
# Setup port 80 as auto http redirect (to https)
[[ListenAddresses]]
  Address = ":80"
  SSL = false
  Task = "httpredirect"
  [ListenAddresses.TaskData]
    [ListenAddresses.TaskData.Redirect]
      HTTPCode = 301

# Use 443 using SSL 
[[ListenAddresses]]
  Address = ":443"
  SSL = true

route1.toml:

ServerNames = ["yourDomain.xyz"]
Interfaces = [":80", ":443"]

# Your ssl stuff
[SSL]
  Key = "./certs/key.pem"
  Cert = "./certs/cert.pem"

[[Location]]
  # Location to match for this route
  Location = "/"
  # Destination (must be a URL to somewhere)
  Destination = "http://127.0.0.1:81/"
  # Is regex in Location
  Regex = false  
  
[[Location]]
  Location = "/hidden/secret/stuff"
  Destination = "http://127.0.0.1:81/admin/"
  # Only allow localhost and 192.168.1.1/24 to access this location
  Deny = "all"
  Allow = ["127.0.0.1", "192.168.1.1/24"]

Important

  • You must specify every interface you use in routes in the config exact the same way!
  • You should put the root location (/) at the end of your locations. The priority is from top to bottom