Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Web Socket Forwarder from connection Web Client to Agent for HTTPS support #414

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hazmi-e205
Copy link

@hazmi-e205 hazmi-e205 commented Jan 23, 2024

Whether this PR is eventually merged or not, Sonic will thank you very much for your contribution.

无论此PR最终是否合并,Sonic组织都非常感谢您的贡献。

Checklist

  • The title starts with fix, fea, or doc. | 标题为fix、feat或doc开头。
  • I have checked that there are no duplicate pull requests with this request. | 我已检查没有与此请求重复的拉取请求。
  • I have considered and confirmed that this submission is valuable to others. | 我已经考虑过,并确认这份呈件对其他人很有价值。
  • I accept that this submission may not be used. | 我接受此提交可能不会被使用。

Description

Due to connecting the Web Client to the Agent directly is pretty hard when it is published in HTTPS, We create a web socket forwarder, so the connection will be converted from "wss://" to "ws://".

@ZhouYixun ZhouYixun mentioned this pull request Jan 23, 2024
2 tasks
@ZhouYixun ZhouYixun changed the title fea: Add Web Socket Forwarder from connection Web Client to Agent for HTTPS support feat: Add Web Socket Forwarder from connection Web Client to Agent for HTTPS support Jan 23, 2024
@prlabeler prlabeler bot added the feature label Jan 23, 2024
@ZhouYixun
Copy link
Member

@hazmi-e205 Thank you for your code! But the front-end should change the ws url, I think you are missing the sonic-client-web pr, right?

@ZhouYixun
Copy link
Member

In fact, forwarding the Agent's data traffic through the server is not the most ideal result, which will make the delay larger.

@yaming116
Copy link
Contributor

All network traffic passing through the server will increase the network pressure and service delay on the server side. The agent needs to upload data to the server, and then the user receives the traffic data from the server. The entire link will be much longer, and the agent needs to have sufficient upload bandwidth and the server has sufficient downlink bandwidth.
If you need the agent to support SSL configuration, you can add nginx in front of the agent, and then resolve it to the intranet IP during domain name resolution.

Note: the https certificate should be "certs/cert.crt" and key should be "certs/cert.key"
@hazmi-e205
Copy link
Author

@yaming116 have you ever tried it?
Actually, last time I tried was switch the agent to HTTPS and the WebSocket upgraded to WSS successfully but the problem is Sonic Client Web can't connect to WSS URL without clear error message.

Here our discussion https://discord.com/channels/1182530185749344307/1193785848223760464

@hotsmile
Copy link

All network traffic passing through the server will increase the network pressure and service delay on the server side. The agent needs to upload data to the server, and then the user receives the traffic data from the server. The entire link will be much longer, and the agent needs to have sufficient upload bandwidth and the server has sufficient downlink bandwidth. If you need the agent to support SSL configuration, you can add nginx in front of the agent, and then resolve it to the intranet IP during domain name resolution.

but ,you can't use wss to remote link to the terminals, right?

@hotsmile
Copy link

All network traffic passing through the server will increase the network pressure and service delay on the server side. The agent needs to upload data to the server, and then the user receives the traffic data from the server. The entire link will be much longer, and the agent needs to have sufficient upload bandwidth and the server has sufficient downlink bandwidth. If you need the agent to support SSL configuration, you can add nginx in front of the agent, and then resolve it to the intranet IP during domain name resolution.
but ,you can't use wss to remote link to the terminals, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants