14 Commits

Author SHA1 Message Date
Alex Ellis (OpenFaaS Ltd)
2a88b5d2f7 Remove ioutil usage
This has been deprecated in Go for some time, in favour of the
io package.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2023-08-22 18:29:28 +01:00
Alex Ellis (OpenFaaS Ltd)
88eea5f62e Feature for probing functions
Introduces a single-flight call to a function's health
endpoint to verify that it is registered with an Istio
sidecar (Envoy) before letting the invocation through.

Results are cached for 5 seconds, before a probe is
required again.

Tested without Istio, with probe_functions environment
variable set to true, I saw a probe execute in the logs.

Fixes: #1721 for Istio users.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2022-07-07 10:35:07 +01:00
Alex Ellis (OpenFaaS Ltd)
238ce1be23 Add feature for invoking namespaced functions
When coupled with the latest version of faas-netes, the gateway
can now invoke, query and deploy functions into alternative
namespaces.

Tested e2e by creating a namespace "fn" and deploying, then
invoking a function deployed there and in the default namespace.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2019-09-20 18:38:55 +01:00
Alex Ellis
78c127619e Remove hop headers
Requested by @LucasRoesler - removes headers detailed in HTTP
spec which are not supposed to be forwarded by proxies or
gateways.

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2019-04-06 20:45:04 +01:00
Stefan Prodan
3e0ed5edd7 Add X-Forwarded-Host test when already present
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2018-09-10 09:57:03 +01:00
Stefan Prodan
3d44fa813a Set upstream X-Forwarded Host and For headers if not present
- remove http client host override fix #847
- X-Forwarded-For and X-Forwarded-Host are usually handled by the ingress
controller, if those headers are not set then the gateway will create them

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2018-09-10 09:57:03 +01:00
Alex Ellis (VMware)
af0ccc9a45 Add Copyright headers where missing in handlers
- Added Copyright in handlers where missing
- Renamed Project to Author(s) where needed

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-09-03 13:26:58 +01:00
Alex Ellis (VMware)
4367fc4e35 Add test coverage for buildUpstreamRequest
Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-08-29 12:41:04 +01:00
Alex Ellis (VMware)
2f98ca8802 Review changes for HTTP paths
This reviews the code and fixes up suggestions made by team for
the HTTP paths PR #789.

- Removed feature-flag (this is backwards-compatible, so I see
no value in adding the flag)
- There was a URL transform happening for calls proxied to the
back end, I changed this for the nil-transform - i.e. it does not
change anything in the URL
- Introduced variables to describe the regex indicies used in
the URL trimming.

Tested with Docker Swarm with a ruby-microservice, with
system calls and with function calls using the UI.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-08-29 12:41:04 +01:00
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)
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