Skip to content

Commit

Permalink
Simplify by having the Gateway strip the initial part of the URL for us.
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas E Lackey <telackey@bozemanpass.com>
  • Loading branch information
telackey authored and alexellis committed Sep 6, 2018
1 parent 016033b commit c96acf7
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions executor/http_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"net/url"
"os"
"os/exec"
"regexp"
"sync"
"time"
)
Expand Down Expand Up @@ -99,13 +98,8 @@ func (f *HTTPFunctionRunner) Run(req FunctionRequest, contentLength int64, r *ht

upstreamURL := f.UpstreamURL.String()

matcher, _ := regexp.Compile("/?function/([^/?]+)(.*)")
parts := matcher.FindStringSubmatch(r.RequestURI)

// The first is the original string, the second the function name
// and the third anything else on the path, including the query string
if 3 == len(parts) {
upstreamURL += parts[2]
if len(r.RequestURI) > 0 {
upstreamURL += r.RequestURI
}

request, _ := http.NewRequest(r.Method, upstreamURL, r.Body)
Expand Down

0 comments on commit c96acf7

Please sign in to comment.