feat: host-based routing in proxy
This commit is contained in:
@ -14,11 +14,23 @@
|
||||
"address": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
"mappings": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"hostPattern": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["hostPattern", "target"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["address", "target"],
|
||||
"required": ["address", "mappings"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,13 @@ type Spec struct {
|
||||
}
|
||||
|
||||
type ProxyEntry struct {
|
||||
Address string `json:"address"`
|
||||
Target string `json:"target"`
|
||||
Address string `json:"address"`
|
||||
Mappings []ProxyMapping `json:"mappings"`
|
||||
}
|
||||
|
||||
type ProxyMapping struct {
|
||||
HostPattern string `json:"hostPattern"`
|
||||
Target string `json:"target"`
|
||||
}
|
||||
|
||||
func (s *Spec) SpecName() spec.Name {
|
||||
|
@ -4,7 +4,12 @@
|
||||
"proxies": {
|
||||
"cadoles.com": {
|
||||
"address": ":3003",
|
||||
"target": "https://www.cadoles.com",
|
||||
"mappings": [
|
||||
{
|
||||
"hostPattern": "localhost:3003",
|
||||
"target": "https://www.cadoles.com"
|
||||
}
|
||||
],
|
||||
"foo": "bar"
|
||||
}
|
||||
}
|
||||
|
7
internal/spec/proxy/testdata/spec-ok.json
vendored
7
internal/spec/proxy/testdata/spec-ok.json
vendored
@ -4,7 +4,12 @@
|
||||
"proxies": {
|
||||
"cadoles.com": {
|
||||
"address": ":3003",
|
||||
"target": "https://www.cadoles.com"
|
||||
"mappings": [
|
||||
{
|
||||
"hostPattern": "localhost:3003",
|
||||
"target": "https://www.cadoles.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user