Skip to content

hotmall/reverseproxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reverse Proxy

install

go get github.com/hotmall/reverseproxy

Usage

import "github.com/emicklei/go-restful"

wss, err := reverseproxy.NewWebService("./etc/proxy")
if err != nil {
    panic("new revese proxy webservice fail")
}
for _, ws := range wss {
  restful.Add(ws)
}

YAML file configuration

title: Reverse Proxy Configuration
version: v1
baseUri: /ops/{version}/dynconf
target: http://127.0.0.1:8000
proxy:
  /global/:
    methods:
      - GET
      - PUT
    pass:
      /dynconf/{version}/global

  /services/:
    methods:
      - GET
      - PUT
    pass:
      /dynconf/{version}/services

  /nodes/:
    methods:
      - GET
      - PUT
    pass:
      /dynconf/{version}/nodes

Note:

proxy:
  /global/:
    methods:
      - GET
      - PUT
    pass:
      /dynconf/{version}/global

Subpath /global/ means url pattern, must begin with /, and end with / means prefix match, no / suffix means exact match.

proxy:
  /:
    methods:
      - GET
      - PUT
    pass:
      /pay/v1/banks

Subpath / means prefix match and exact match.

About

Reverse proxy service based on go-restful

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages