Add support for unix socket as upstream (#1866)

* Add support for unix socket as upstream

* Add CHANGELOG.md entry

* Add Unix socket documentation

* Don't export unixRoundTripper, switch from string prefix to Scheme match

* Add basic unix server mock

* Add some tests and comments
This commit is contained in:
Damien Degois
2023-10-26 10:57:00 +01:00
committed by GitHub
parent 4816e87316
commit 70571d96e1
9 changed files with 108 additions and 9 deletions
+26
View File
@@ -98,6 +98,11 @@ var _ = Describe("Proxy Suite", func() {
RewriteTarget: "/double-match/rewrite/$1",
URI: serverAddr,
},
{
ID: "unix-upstream",
Path: "/unix/",
URI: unixServerAddr,
},
}
}
@@ -337,6 +342,27 @@ var _ = Describe("Proxy Suite", func() {
},
upstream: "",
}),
Entry("with a request to the UNIX socket backend", &proxyTableInput{
target: "http://example.localhost/unix/file",
response: testHTTPResponse{
code: 200,
header: map[string][]string{
contentType: {applicationJSON},
},
request: testHTTPRequest{
Method: "GET",
URL: "http://example.localhost/unix/file",
Header: map[string][]string{
"Gap-Auth": {""},
"Gap-Signature": {"sha256 4ux8esLj2fw9sTWZwgFhb00bGbw0Fnhed5Fm9jz5Blw="},
},
Body: []byte{},
Host: "example.localhost",
RequestURI: "http://example.localhost/unix/file",
},
},
upstream: "unix-upstream",
}),
)
})