Remove request path when routing

Route all requests to / on the function run container.  It doesn't
need to do any routing since it has only one function.
This commit is contained in:
Soam Vasani
2016-11-03 10:11:43 -07:00
parent bbaa766fe1
commit 1b76cdf200
+8 -2
View File
@@ -71,12 +71,18 @@ func (fh *functionHandler) handler(responseWriter http.ResponseWriter, request *
// TODO: As an optimization we may want to cache proxies too -- this might get us
// connection reuse and possibly better performance
director := func(req *http.Request) {
log.Printf("Proxying request for %v", req.URL)
log.Printf("Proxying request for %v to %v", req.URL, serviceUrl.Host)
// send this request to serviceurl
req.URL.Scheme = serviceUrl.Scheme
req.URL.Host = serviceUrl.Host
req.URL.Path = serviceUrl.Path
// To keep the function run container simple, it
// doesn't do any routing. In the future if we have
// multiple functions per container, we could use the
// function metadata here.
req.URL.Path = "/"
// leave the query string intact (req.URL.RawQuery)
if _, ok := req.Header["User-Agent"]; !ok {