Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
barry cho
Rancher
Commits
a46d5831
Commit
a46d5831
authored
4 years ago
by
Darren Shepherd
Browse files
Options
Download
Email Patches
Plain Diff
Fix shell in ember UI
parent
7f398fb3
master
2.4-head
2.5-head
aecdb0589
ansilh-cs-status-logging
cfbd0d3
cloudnautique-patch-1
cwarren/automate_private_registry_1
dev
dnoland1-cores-metric-patch
dnoland1-patch-1
dnoland1-patch-2
dnoland1-patch-3
dnoland1-patch-4
kinarashah-patch-1
mrajashree-patch-1
not-release/v2.5.11
rc-19
release/v1.1
release/v2.5
release/v2.5.11
release/v2.5.11-alt
release/v2.5.11-patch1
release/v2.5.3
release/v2.5.5
release/v2.5.7
release/v2.5.7-patch1
release/v2.5.8
release/v2.5.8-patch1
release/v2.5.8-patch2
release/v2.5.8-patch3
release/v2.5.8-rc1
release/v2.5.9
release/v2.5.9-debug1
release/v2.6
release/v2.6.2
revert-29888-revert-ingress-version-fwd
revert-29936-fleet-gitjob-proxy-support
revert-30671-release/v2.5
revert-30698-revert-30671-release/v2.5
revert-31102-restrictedadminrancher
revert-31118-fwd_restrictedadmin
revert-35793-temporarily-disable-fossa
snyk-fix-0564176c790784e319dbf499a8a4b2b8
update-issue-templates
Tags unavailable
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/api/steve/proxy/proxy.go
+7
-5
pkg/api/steve/proxy/proxy.go
with
7 additions
and
5 deletions
+7
-5
pkg/api/steve/proxy/proxy.go
+
7
-
5
View file @
a46d5831
...
...
@@ -66,12 +66,10 @@ func NewProxyMiddleware(sar v1.SubjectAccessReviewInterface,
mux
:=
gmux
.
NewRouter
()
mux
.
UseEncodedPath
()
mux
.
Path
(
"/v1/management.cattle.io.clusters/{clusterID}"
)
.
Queries
(
"link"
,
"shell"
)
.
HandlerFunc
(
routeToProxy
(
localSupport
,
localCluster
,
mux
,
proxyHandler
))
mux
.
Path
(
"/v1/management.cattle.io.clusters/{clusterID}"
)
.
Queries
(
"link"
,
"shell"
)
.
HandlerFunc
(
routeToShellProxy
(
localSupport
,
localCluster
,
mux
,
proxyHandler
))
mux
.
Path
(
"/v3/clusters/{clusterID}"
)
.
Queries
(
"shell"
,
"true"
)
.
HandlerFunc
(
routeToShellProxy
(
localSupport
,
localCluster
,
mux
,
proxyHandler
))
mux
.
Path
(
"/{prefix:k8s/clusters/[^/]+}{suffix:/v1.*}"
)
.
MatcherFunc
(
proxyHandler
.
MatchNonLegacy
(
"/k8s/clusters/"
,
true
))
.
Handler
(
proxyHandler
)
mux
.
Path
(
"/{prefix:k8s/clusters/[^/]+}{suffix:.*}"
)
.
MatcherFunc
(
proxyHandler
.
MatchNonLegacy
(
"/k8s/clusters/"
,
false
))
.
Handler
(
proxyHandler
)
mux
.
Path
(
"/v3/clusters/{id}"
)
.
Queries
(
"shell"
,
"true"
)
.
HandlerFunc
(
func
(
rw
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
routeToShellLink
(
rw
,
req
,
mux
.
NotFoundHandler
)
})
return
func
(
handler
http
.
Handler
)
http
.
Handler
{
return
http
.
HandlerFunc
(
func
(
rw
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
...
...
@@ -95,7 +93,7 @@ func routeToShellLink(rw http.ResponseWriter, req *http.Request, next http.Handl
next
.
ServeHTTP
(
rw
,
req
)
}
func
routeToProxy
(
localSupport
bool
,
localCluster
http
.
Handler
,
mux
*
gmux
.
Router
,
proxyHandler
*
Handler
)
func
(
rw
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
func
routeTo
Shell
Proxy
(
localSupport
bool
,
localCluster
http
.
Handler
,
mux
*
gmux
.
Router
,
proxyHandler
*
Handler
)
func
(
rw
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
return
func
(
rw
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
vars
:=
gmux
.
Vars
(
r
)
cluster
:=
vars
[
"clusterID"
]
...
...
@@ -109,6 +107,10 @@ func routeToProxy(localSupport bool, localCluster http.Handler, mux *gmux.Router
}
vars
[
"prefix"
]
=
"k8s/clusters/"
+
cluster
vars
[
"suffix"
]
=
"/v1/management.cattle.io.clusters/local"
// Ensure shell link is set
q
:=
r
.
URL
.
Query
()
q
.
Set
(
"link"
,
"shell"
)
r
.
URL
.
RawQuery
=
q
.
Encode
()
r
.
URL
.
Path
=
"/k8s/clusters/"
+
cluster
+
"/v1/management.cattle.io.clusters/local"
proxyHandler
.
ServeHTTP
(
rw
,
r
)
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help