mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Make kubectl proxy accept empty path
The proxy previously returned 403 Forbidden: Unauthorized when receiving a request from e.g. "curl localhost:8001" or "curl localhost:8001/". The previous DefaultPathAcceptRE regex was wrong as it assumed the path in this case would be "/" (but it is actually "").
This commit is contained in:
parent
1ee7163308
commit
c0aa2767aa
@ -34,7 +34,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
DefaultHostAcceptRE = "^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$"
|
DefaultHostAcceptRE = "^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$"
|
||||||
DefaultPathAcceptRE = "^/.*"
|
DefaultPathAcceptRE = "^.*"
|
||||||
DefaultPathRejectRE = "^/api/.*/pods/.*/exec,^/api/.*/pods/.*/attach"
|
DefaultPathRejectRE = "^/api/.*/pods/.*/exec,^/api/.*/pods/.*/attach"
|
||||||
DefaultMethodRejectRE = "POST,PUT,PATCH"
|
DefaultMethodRejectRE = "POST,PUT,PATCH"
|
||||||
)
|
)
|
||||||
|
@ -40,6 +40,15 @@ func TestAccept(t *testing.T) {
|
|||||||
expectAccept bool
|
expectAccept bool
|
||||||
}{
|
}{
|
||||||
|
|
||||||
|
{
|
||||||
|
acceptPaths: DefaultPathAcceptRE,
|
||||||
|
rejectPaths: DefaultPathRejectRE,
|
||||||
|
acceptHosts: DefaultHostAcceptRE,
|
||||||
|
path: "",
|
||||||
|
host: "127.0.0.1",
|
||||||
|
method: "GET",
|
||||||
|
expectAccept: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
acceptPaths: DefaultPathAcceptRE,
|
acceptPaths: DefaultPathAcceptRE,
|
||||||
rejectPaths: DefaultPathRejectRE,
|
rejectPaths: DefaultPathRejectRE,
|
||||||
|
Loading…
Reference in New Issue
Block a user