Skip to content

Commit

Permalink
fix(webconsole): vnc add cookie head (#21827)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Dec 18, 2024
1 parent c2bc6b1 commit 554368f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ require (
k8s.io/cri-api v0.22.17
k8s.io/klog/v2 v2.20.0
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241216075633-a8665686cf63
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241218101206-5e3f6758dc2c
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256
yunion.io/x/jsonutils v1.0.1-0.20240930100528-1671a2d0d22f
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1376,8 +1376,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241216075633-a8665686cf63 h1:j5XE/WcpbSolZfeQueXmtxiVVxdQWC2Qr9RtNnzEwR0=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241216075633-a8665686cf63/go.mod h1:rj/pb3DitJlQaQD8UW1oxx/KD+PzDZqoywzqRJaFE9A=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241218101206-5e3f6758dc2c h1:h5qhNEV9VsJ6VkbC/lmV+kZW2ZsMT+DRDwb+gGIpr+w=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241218101206-5e3f6758dc2c/go.mod h1:rj/pb3DitJlQaQD8UW1oxx/KD+PzDZqoywzqRJaFE9A=
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256 h1:kLKQ6zbgPDQflRwoHFAjxNChcbhXIFgsUVLkJwiXu/8=
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
Expand Down
5 changes: 5 additions & 0 deletions pkg/webconsole/server/websocketproxy_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
type WebsocketProxyServer struct {
Session *session.SSession
proxy *websocketproxy.WebsocketProxy
cookie string
}

func NewWebsocketProxyServer(s *session.SSession) (*WebsocketProxyServer, error) {
Expand All @@ -56,9 +57,13 @@ func NewWebsocketProxyServer(s *session.SSession) (*WebsocketProxyServer, error)
return &WebsocketProxyServer{
Session: s,
proxy: proxySrv,
cookie: info.Cookie,
}, nil
}

func (s *WebsocketProxyServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if len(s.cookie) > 0 {
r.Header.Set("Cookie", s.cookie)
}
s.proxy.ServeHTTP(w, r)
}
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
# sigs.k8s.io/yaml v1.2.0
## explicit; go 1.12
sigs.k8s.io/yaml
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241216075633-a8665686cf63
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241218101206-5e3f6758dc2c
## explicit; go 1.21
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
Expand Down
3 changes: 3 additions & 0 deletions vendor/yunion.io/x/cloudmux/pkg/cloudprovider/instance.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 554368f

Please sign in to comment.