[GH-ISSUE #2125] 使用http2https插件时websocket无法连接 #1690

Closed
opened 2026-05-05 13:05:01 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @tgly307 on GitHub (Dec 2, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/2125

[REQUIRED] hat version of frp are you using

Version: 0.34.0

[REQUIRED] What operating system and processor architecture are you using
OS: windows
CPU architecture: x86

[REQUIRED] description of errors

confile

frpc.ini
-----
[proxmox]
type = http
subdomain = proxmox
plugin = http2https
plugin_local_addr = 192.168.1.116:8006
plugin_host_header_rewrite = 192.168.1.116:8006
plugin_header_X-From-Where = frp

log file

Steps to reproduce the issue

  1. 按照上述配置文件启动frpc,frps无特殊设置
  2. 访问对应站点,启动websocket服务
  3. wss连接超时

Supplementary information
我在内网安装了ProxmoxVE(PVE),PVE自带了https服务,目前通过https方式穿透是完全正常的。
frps所在设备的443端口被nginx占用,用于给frpc的http服务提供证书转为https,因此frpc的https服务只能映射到其他端口,例如8088,这样外网的访问连接为https://example.com:8088
我希望在穿透到外网时也复用443端口,通过http2https插件后可以正常登录和访问页面,但是打开控制台时用到了websocket,wss协议连接会超时。
Can you guess what caused this issue

Checklist:

  • [] I included all information required in the sections above
  • [] I made sure there are no duplicates of this report (Use Search)
Originally created by @tgly307 on GitHub (Dec 2, 2020). Original GitHub issue: https://github.com/fatedier/frp/issues/2125 <!-- From Chinese to English by machine translation, welcome to revise and polish. --> <!-- ⚠️⚠️ Incomplete reports will be marked as invalid, and closed, with few exceptions ⚠️⚠️ --> <!-- in addition, please use search well so that the same solution can be found in the feedback, we will close it directly --> <!-- for convenience of differentiation, use FRPS or FRPC to refer to the FRP server or client --> **[REQUIRED] hat version of frp are you using** <!-- Use ./frpc -v or ./frps -v --> Version: 0.34.0 **[REQUIRED] What operating system and processor architecture are you using** OS: windows CPU architecture: x86 **[REQUIRED] description of errors** **confile** <!-- Please pay attention to hiding the token, server_addr and other privacy information --> ``` frpc.ini ----- [proxmox] type = http subdomain = proxmox plugin = http2https plugin_local_addr = 192.168.1.116:8006 plugin_host_header_rewrite = 192.168.1.116:8006 plugin_header_X-From-Where = frp ``` **log file** <!-- If the file is too large, use Pastebin, for example https://pastebin.ubuntu.com/ --> **Steps to reproduce the issue** 1. 按照上述配置文件启动frpc,frps无特殊设置 2. 访问对应站点,启动websocket服务 3. wss连接超时 **Supplementary information** 我在内网安装了ProxmoxVE(PVE),PVE自带了https服务,目前通过https方式穿透是完全正常的。 frps所在设备的443端口被nginx占用,用于给frpc的http服务提供证书转为https,因此frpc的https服务只能映射到其他端口,例如8088,这样外网的访问连接为https://example.com:8088 我希望在穿透到外网时也复用443端口,通过http2https插件后可以正常登录和访问页面,但是打开控制台时用到了websocket,wss协议连接会超时。 **Can you guess what caused this issue** **Checklist**: <!--- Make sure you've completed the following steps (put an "X" between of brackets): --> - [] I included all information required in the sections above - [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/fatedier/frp/issues?q=is%3Aissue)
Author
Owner

@Becods commented on GitHub (Dec 3, 2020):

建议使用nginx解决443冲突问题
frpc设置为tcp
反代后需要加入特殊协议头

proxy_redirect off;
proxy_pass http://wss_svr;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;   # 升级协议头
proxy_set_header Connection upgrade;
<!-- gh-comment-id:737816335 --> @Becods commented on GitHub (Dec 3, 2020): 建议使用nginx解决443冲突问题 frpc设置为tcp 反代后需要加入特殊协议头 ``` proxy_redirect off; proxy_pass http://wss_svr; proxy_set_header Host $host; proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr:$remote_port; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; # 升级协议头 proxy_set_header Connection upgrade; ```
Author
Owner

@tgly307 commented on GitHub (Dec 3, 2020):

建议使用nginx解决443冲突问题
frpc设置为tcp
反代后需要加入特殊协议头

proxy_redirect off;
proxy_pass http://wss_svr;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;   # 升级协议头
proxy_set_header Connection upgrade;

十分感谢!

<!-- gh-comment-id:738140726 --> @tgly307 commented on GitHub (Dec 3, 2020): > 建议使用nginx解决443冲突问题 > frpc设置为tcp > 反代后需要加入特殊协议头 > > ``` > proxy_redirect off; > proxy_pass http://wss_svr; > proxy_set_header Host $host; > proxy_set_header X-Real_IP $remote_addr; > proxy_set_header X-Forwarded-For $remote_addr:$remote_port; > proxy_http_version 1.1; > proxy_set_header Upgrade $http_upgrade; # 升级协议头 > proxy_set_header Connection upgrade; > ``` 十分感谢!
Author
Owner

@urzz commented on GitHub (Feb 4, 2021):

@tgly307 可以分享下你的配置么?有点不理解frpc设置为tcp后应该如何配置。。

<!-- gh-comment-id:773077473 --> @urzz commented on GitHub (Feb 4, 2021): @tgly307 可以分享下你的配置么?有点不理解frpc设置为tcp后应该如何配置。。
Author
Owner

@tgly307 commented on GitHub (Feb 6, 2021):

@urzz 抱歉看到晚了,我的nginx配置是这样的,frp将对应端口映射到VPS的6000端口。

server {
       listen       443;
       server_name  xxx.domain.com;
       ssl_certificate      /path/to/fullchain.pem;
       ssl_certificate_key  /path/to/privkey.pem;
       ssl_session_cache    shared:SSL:1m;
       ssl_session_timeout  5m;
       ssl_ciphers  HIGH:!aNULL:!MD5;
       ssl_prefer_server_ciphers  on;
       location / {
           proxy_redirect off;
           proxy_pass https://127.0.0.1:6000;
           client_max_body_size 1000m;
           proxy_set_header    Host $host;
           proxy_set_header    Upgrade $http_upgrade;
           proxy_set_header    Connection "upgrade";
           proxy_set_header    X-Real-IP $remote_addr;
           proxy_hide_header   X-Powered-By;
           proxy_set_header    X-Forwarded-Proto $scheme;
           proxy_set_header     X-Forwarded-For $remote_addr:$remote_port;
           proxy_http_version 1.1;
       }
   }

frpc的配置如下

[test_tcp]
type = tcp
local_ip = 192.168.1.111
local_port = 443
remote_port = 6000
<!-- gh-comment-id:774388347 --> @tgly307 commented on GitHub (Feb 6, 2021): @urzz 抱歉看到晚了,我的nginx配置是这样的,frp将对应端口映射到VPS的6000端口。 ``` server { listen 443; server_name xxx.domain.com; ssl_certificate /path/to/fullchain.pem; ssl_certificate_key /path/to/privkey.pem; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { proxy_redirect off; proxy_pass https://127.0.0.1:6000; client_max_body_size 1000m; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Real-IP $remote_addr; proxy_hide_header X-Powered-By; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr:$remote_port; proxy_http_version 1.1; } } ``` frpc的配置如下 ``` [test_tcp] type = tcp local_ip = 192.168.1.111 local_port = 443 remote_port = 6000 ```
Author
Owner

@tin607 commented on GitHub (Mar 15, 2024):

建议使用nginx解决443冲突问题
frpc设置为tcp
反代后需要加入特殊协议头

proxy_redirect off;
proxy_pass http://wss_svr;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;   # 升级协议头
proxy_set_header Connection upgrade;

十分感谢!

感谢

<!-- gh-comment-id:1998836574 --> @tin607 commented on GitHub (Mar 15, 2024): > > 建议使用nginx解决443冲突问题 > > frpc设置为tcp > > 反代后需要加入特殊协议头 > > ``` > > proxy_redirect off; > > proxy_pass http://wss_svr; > > proxy_set_header Host $host; > > proxy_set_header X-Real_IP $remote_addr; > > proxy_set_header X-Forwarded-For $remote_addr:$remote_port; > > proxy_http_version 1.1; > > proxy_set_header Upgrade $http_upgrade; # 升级协议头 > > proxy_set_header Connection upgrade; > > ``` > > 十分感谢! 感谢
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#1690
No description provided.