[GH-ISSUE #1377] [建议]希望在https2http中添加一个head #1091

Closed
opened 2026-05-05 12:42:06 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @status301 on GitHub (Aug 12, 2019).
Original GitHub issue: https://github.com/fatedier/frp/issues/1377

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.
(为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)
(请不要在 issue 评论中出现无意义的 加1我也是 等内容,将会被直接删除。)
(由于个人精力有限,和系统环境,网络环境等相关的求助问题请转至其他论坛或社交平台。)

Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)?
0.27.0

What operating system and processor architecture are you using (go env)?

Configures you used:
frps : ip 172.17.0.1

[common]
token = ******
#bind_addr = 0.0.0.0
bind_port = 80
bind_udp_port = 81
kcp_bind_port = 80
vhost_http_port = 80
vhost_https_port = 443
vhost_http_timeout = 60

max_ports_per_client = 0
tcp_mux = true

frpc:

[root@HK ~]# cat frpc.ini
[common]
token = ***
server_port = 80
server_addr = ***
protocol = tcp
user = X

log_level = trace

[S*]
type = https
custom_domains = *.domain1.cn
header_security = https
plugin = https2http
plugin_local_addr = 172.17.0.1:80
plugin_crt_path = /root/cert/domain1.cn/fullchain.cer
plugin_key_path = /root/cert/domain1.cn/domain1.cn.key

################
[fy]
type = http
local_port = 80
local_ip = 127.0.0.1
custom_domains = fy.domain1.cn
header_X-From-Where = fy

Steps to reproduce the issue:

  1. 访问http://fy.domain1.cn

Describe the results you expected:
在https2http中增加一个head,让后端能判断浏览器是否使用https访问(让后端将页面重定向到https)

Additional information you deem important (e.g. issue happens only occasionally):
现在只能在页面中使用js强制跳转页面,会使页面加载两次

window.onload = function(){
    var urls=window.location.href;
    urls = urls.replace('http', 'https');
    window.location=urls;
}

Can you point out what caused this issue (optional)

Originally created by @status301 on GitHub (Aug 12, 2019). Original GitHub issue: https://github.com/fatedier/frp/issues/1377 Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. (为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。) (请不要在 issue 评论中出现无意义的 **加1**,**我也是** 等内容,将会被直接删除。) (由于个人精力有限,和系统环境,网络环境等相关的求助问题请转至其他论坛或社交平台。) Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST **What version of frp are you using (./frpc -v or ./frps -v)?** 0.27.0 **What operating system and processor architecture are you using (`go env`)?** **Configures you used:** frps : ip 172.17.0.1 ``` [common] token = ****** #bind_addr = 0.0.0.0 bind_port = 80 bind_udp_port = 81 kcp_bind_port = 80 vhost_http_port = 80 vhost_https_port = 443 vhost_http_timeout = 60 max_ports_per_client = 0 tcp_mux = true ``` frpc: ``` [root@HK ~]# cat frpc.ini [common] token = *** server_port = 80 server_addr = *** protocol = tcp user = X log_level = trace [S*] type = https custom_domains = *.domain1.cn header_security = https plugin = https2http plugin_local_addr = 172.17.0.1:80 plugin_crt_path = /root/cert/domain1.cn/fullchain.cer plugin_key_path = /root/cert/domain1.cn/domain1.cn.key ################ [fy] type = http local_port = 80 local_ip = 127.0.0.1 custom_domains = fy.domain1.cn header_X-From-Where = fy ``` **Steps to reproduce the issue:** 1. 访问http://fy.domain1.cn **Describe the results you expected:** 在https2http中增加一个head,让后端能判断浏览器是否使用https访问(让后端将页面重定向到https) **Additional information you deem important (e.g. issue happens only occasionally):** 现在只能在页面中使用js强制跳转页面,会使页面加载两次 ``` window.onload = function(){ var urls=window.location.href; urls = urls.replace('http', 'https'); window.location=urls; } ``` **Can you point out what caused this issue (optional)**
gitea-mirror 2026-05-05 12:42:06 -06:00
  • closed this issue
  • added the
    todo
    label
Author
Owner

@fatedier commented on GitHub (Aug 12, 2019):

可以支持。

在 https2http 的 plugin 中增加 plugin_header_ 开头的配置,和 http 类型的 header_ 作用相同。

例如:

[S*]
type = https
custom_domains = *.domain1.cn
header_security = https
plugin = https2http
plugin_local_addr = 172.17.0.1:80
plugin_crt_path = /root/cert/domain1.cn/fullchain.cer
plugin_key_path = /root/cert/domain1.cn/domain1.cn.key
plugin_header_X-From-Where = httpsfrp
<!-- gh-comment-id:520388710 --> @fatedier commented on GitHub (Aug 12, 2019): 可以支持。 在 https2http 的 plugin 中增加 `plugin_header_` 开头的配置,和 http 类型的 `header_` 作用相同。 例如: ```ini [S*] type = https custom_domains = *.domain1.cn header_security = https plugin = https2http plugin_local_addr = 172.17.0.1:80 plugin_crt_path = /root/cert/domain1.cn/fullchain.cer plugin_key_path = /root/cert/domain1.cn/domain1.cn.key plugin_header_X-From-Where = httpsfrp ```
Author
Owner

@status301 commented on GitHub (Aug 13, 2019):

@fatedier 建议使https支持header_ ,这样覆盖面会广一点
在frpc的https中配置header_security = https 后,后端并没有收到相关head。
https://github.com/fatedier/frp/blob/master/conf/frpc_full.ini
frpc:

[S*]
type = https
custom_domains = *.domain1.cn
header_security = https 此行没有生效,后台找不到
plugin = https2http
plugin_local_addr = 172.17.0.1:80
plugin_crt_path = /root/cert/domain1.cn/fullchain.cer
plugin_key_path = /root/cert/domain1.cn/domain1.cn.key
<!-- gh-comment-id:520662135 --> @status301 commented on GitHub (Aug 13, 2019): @fatedier 建议使https支持header_ ,这样覆盖面会广一点 在frpc的https中配置header_security = https 后,后端并没有收到相关head。 [https://github.com/fatedier/frp/blob/master/conf/frpc_full.ini](https://github.com/fatedier/frp/blob/master/conf/frpc_full.ini) frpc: ``` [S*] type = https custom_domains = *.domain1.cn header_security = https 此行没有生效,后台找不到 plugin = https2http plugin_local_addr = 172.17.0.1:80 plugin_crt_path = /root/cert/domain1.cn/fullchain.cer plugin_key_path = /root/cert/domain1.cn/domain1.cn.key ```
Author
Owner

@fatedier commented on GitHub (Aug 13, 2019):

@status301 https 无法支持,只有 http 可以支持。
服务端不存储用户证书,不会解析 https 协议,如果有这样的需求,建议前面挡一个 nginx。

<!-- gh-comment-id:520668217 --> @fatedier commented on GitHub (Aug 13, 2019): @status301 https 无法支持,只有 http 可以支持。 服务端不存储用户证书,不会解析 https 协议,如果有这样的需求,建议前面挡一个 nginx。
Author
Owner

@status301 commented on GitHub (Aug 13, 2019):

我明白了,还是加plugin_header_吧

<!-- gh-comment-id:520681441 --> @status301 commented on GitHub (Aug 13, 2019): 我明白了,还是加plugin_header_吧
Author
Owner

@fatedier commented on GitHub (Aug 29, 2019):

Support in v0.29.0

<!-- gh-comment-id:526203026 --> @fatedier commented on GitHub (Aug 29, 2019): Support in v0.29.0
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#1091
No description provided.