18 Commits

Author SHA1 Message Date
Thomas E Lackey
decf9addb3 Make 'URLPathTransformer' interface and implementation to do the function prefix trimming instead of baking it in. Also add a configuration option, 'pass_url_path_to_functions' to control whether the full path is passed to the functions or not.
Signed-off-by: Thomas E Lackey <telackey@bozemanpass.com>
2018-08-29 12:41:04 +01:00
Thomas E Lackey
7870b87c38 Implement proposal 716, passing full paths through the Gateway and fwatchdog.
Previously, only the query string of the URL was passed through the Gateway.
With this change, the entire path requested by the client is passed through as well as the query string.

While fwatchdog already supported passing the path through, in practice this would not happen
since the Gateway would have swallowed it before forwarding the request to the watchdog.

With this change, the path portion after the function name is added to the Http_Path environment
variable, provided that cgiHeaders are enabled.  This is similar to the of-watchdog equivalent.

Signed-off-by: Thomas E Lackey <telackey@bozemanpass.com>
2018-08-29 12:41:04 +01:00
Dmitri Rubinstein
fd0abe46dd Propagate Host header from gateway request to the function.
Host HTTP header was not propagated to the function because it is not
a part of http.Request.Header map.

Signed-off-by: Dmitri Rubinstein <dmitri.rubinstein@googlemail.com>
2018-08-16 16:20:28 +01:00
Lucas Roesler
6676d1b807 Trim tailing slash from service name before proxy
**What**
- When determining the service name of the function, remove any trailing
slashes, the slashes are not allowed in service names for either Swarm
or K8S, so this can only be a left over from the url path

**Why**
- This was preventing service resolution, and hence failed functions,
    when the function was called with a trailing slash

Fixes #714

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
2018-06-16 16:05:09 -07:00
Alex Ellis (VMware)
65ed8457af Fix issue in passing-through of proxy body
Proxy body was being passed correctly due to placement of defer
statement. This has been moved into outer scope to resolve issue.

Tested with new e2e tests in certifier component.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-03-27 21:12:38 +01:00
Alex Ellis (VMware)
58bd87c811 Update proxy to pass query-string
HTTP proxy was not passing query-string upstream. This change
reinstates the behaviour through TDD - adding test coverage and
automated regression testing.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-03-27 19:33:43 +01:00
Alex Ellis
0c7e59fe8a Add direct_functions mode to gateway for tuning
Adds a pair of configuration options for performance tuning. The
gateway can now invoke functions directly and can bypass the
provider. See updated table in README.md for configuration values.

BaseURLResolver is added with unit tests that decouples resolving
upstream URL from the reverse proxy client code.

- SingleHostBaseURLResolver resolves a single upstream host
- FunctionAsHostBaseURLResolver resolves host based upon conventions
within the URL of the request to a function for direct access

Tested with Kubernetes (faas-netes) and faas-swarm through UI, CLI
calling system endpoints and functions directly.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-03-23 16:35:37 +00:00
Alex Ellis (VMware)
c716c54868 Break out logging / metrics for functions in forwarding_proxy
Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-03-20 09:51:42 +00:00
Alex Ellis
37ef024df7 Proxy fix - copy request headers into upstream
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2018-03-05 15:31:25 +00:00
Alex Ellis
6efaee5b4f Add upstream_timeout as env-var
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2018-03-05 12:49:25 +00:00
Alex Ellis
30928739ee Use context for upstream timeouts
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2018-03-05 12:49:25 +00:00
Alex Ellis
fdc7f08ba2 Pass along status code
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2018-03-03 17:36:33 +00:00
Alex Ellis
7120e4c5f4 Apply comments and naming conventions to HTTP proxy
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2018-03-03 17:36:33 +00:00
Alex Ellis
26e0de3497 Remove Golang reverseproxy and use http Client
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2018-03-03 17:36:33 +00:00
Alex Ellis
ff9f7a5541 Make debugging less verbose
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2018-02-01 09:37:05 +00:00
Alex Ellis
23a7187435 Refactoring: variable names, adding tests and http constants
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-12-05 06:50:08 -06:00
John McCabe
89878f0c8a Migrate from alexellis org to openfaas
Note, not all `alexellis/github` references should be changed, there are
a number of repos which are not part of the openfaas org, this commit
excludes those.

Signed-off-by: John McCabe <john@johnmccabe.net>
2017-10-04 09:18:06 +01:00
Alex Ellis
ec22a301fe Refactor out handler file from server.go
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-09-13 10:28:40 -07:00