api/resolver: update resolver to enable subdomain routing (#1747)

* api/resolver: update domain / service prefix usage

* api/resolver/subdomain: implement subdomain resolver for domain resolution

* api/handler: fix tests
This commit is contained in:
ben-toogood
2020-06-26 14:28:18 +01:00
committed by GitHub
parent 4f0f4326df
commit 104b7d8f8d
10 changed files with 211 additions and 44 deletions

View File

@@ -18,13 +18,13 @@ func (r *Resolver) Resolve(req *http.Request) (*resolver.Endpoint, error) {
}
parts := strings.Split(req.URL.Path[1:], "/")
ns := r.opts.Namespace(req)
return &resolver.Endpoint{
Name: ns + "." + parts[0],
Name: r.opts.ServicePrefix + "." + parts[0],
Host: req.Host,
Method: req.Method,
Path: req.URL.Path,
Domain: r.opts.Domain,
}, nil
}