Skip to content

sanhapon/hupe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hupe

A reverse proxy in rust which is built on top of hyper. Below are current features:

  • Multi downstreams per request path
  • Retries with next downstreams
  • Automatically checks if downstream is coming back
  • Supports https/http to downstreams
  • Caches static files (js/css).
  • Supports gzip and brotli compression based on request header for static files
  • Requests logs (log4rs)

Running with docker

Mininum prequisite is config.yaml; you will to put configuration to '/usr/local/bin/hupe/config.yaml' in the docker container. Optionally, we can mount static files too (based on configuration)


1. Edit configuration file (config.yaml)


configuration: 
  listening_port: 80
  enable_retry: true
  enable_log: true
  request_paths: 
    - down_streams: 
        - https://www.example.com
        - https://api.localhost2
      map_to: /another
      uri_path: /another/*
    - down_streams: 
        - http://example.com
        - http://api.localhost1
      map_to: /
      uri_path: /*

Note: above configurations mean:


2. Container


- Image from docker hup

```
docker run -p 80:80 -v config.yaml:/usr/local/bin/hupe/config.yaml -v assets:/usr/local/bin/hupe/assets p3go/hupe:v.0.1
```

- Build and run docker
```
docker build . -t hupe
docker run -p 80:80 -v config.yaml:/usr/local/bin/hupe/config.yaml -v assets:/usr/local/bin/hupe/assets hupe
```


Configure config.yaml to map static files


configuration: 
  listening_port: 80
  enable_retry: true
  enable_log: true
  request_paths: 
    - down_streams: 
        - http://example.com
        - http://api.localhost1
      map_to: /
      uri_path: /*
    - down_streams: 
        - https://www.example.com
        - http://api.localhost2
      map_to: /another
      uri_path: /another/*
  request_files: 
    - uri_path: /assets/js
      map_to: /usr/local/bin/hupe/assets/js
    - uri_path: /assets/css
      map_to: /usr/local/bin/hupe/assets/css

Note: this time we forward any request starting with '/assets/js' to directory '/usr/local/bin/hupe/assets/js', for example, 'http://localhost/assets/js/index.js', we map (or read) to file system: '/usr/local/bin/hupe/assets/js/index.js'

About

Reverse proxy in rust, build on top of hyper

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages