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

做二级代理时无法修改http请求 #180

Closed
yuukh opened this issue Jan 8, 2023 · 4 comments
Closed

做二级代理时无法修改http请求 #180

yuukh opened this issue Jan 8, 2023 · 4 comments

Comments

@yuukh
Copy link

yuukh commented Jan 8, 2023

一级代理是clashmeta v1.14.0,clashmeta分流部分域名至elev2p,当一个网络请求先进入clashmeta然后被分流到elecv2p处理时,如果这个网络请求为https则可以成功被重写,如果网络请求为http则没有重写效果。
以www.sina.com为例,下面是重写规则和脚本内容
image
image

下面为测试结果和日志
1.代理服务器为clashmeta,分流至elecv2p,网络请求使用https协议
image

[AnyProxy Log][2023-01-08 14:47:53]: received https CONNECT request www.sina.com
[AnyProxy Log][2023-01-08 14:47:53]: will forward to local https server
[AnyProxy Log][2023-01-08 14:47:53]: received request to: GET www.sina.com/
[eV2Proxy    info][2023-01-08 14:47:53.561] https://www.sina.com/ response match rule: ^https?://www.sina.com test.js from rewrite cache
[runJSFile notify][2023-01-08 14:47:53.563] run test.js from rewriteRes
[test.js     info][2023-01-08 14:47:53.572] hello elecV2P, nice to meet you!
[test.js     info][2023-01-08 14:47:53.574] current version 3.7.5
[test.js     info][2023-01-08 14:47:53.574] Project: https://github.com/elecV2/elecV2P
[test.js     info][2023-01-08 14:47:53.575] Docs: https://github.com/elecV2/elecV2P-dei
[test.js     info][2023-01-08 14:47:53.576] telegram channel: https://t.me/elecV2
[runJSFile   info][2023-01-08 14:47:53.577] run test.js result: elecV2P test done
[AnyProxy Log][2023-01-08 14:47:54]: received request to: GET www.sina.com/favicon.ico
[eV2Proxy    info][2023-01-08 14:47:54.341] https://www.sina.com/favicon.ico response match rule: ^https?://www.sina.com test.js from rewrite cache
[runJSFile notify][2023-01-08 14:47:54.342] run test.js from rewriteRes
[test.js     info][2023-01-08 14:47:54.346] hello elecV2P, nice to meet you!
[test.js     info][2023-01-08 14:47:54.347] current version 3.7.5
[test.js     info][2023-01-08 14:47:54.347] Project: https://github.com/elecV2/elecV2P
[test.js     info][2023-01-08 14:47:54.348] Docs: https://github.com/elecV2/elecV2P-dei
[test.js     info][2023-01-08 14:47:54.348] telegram channel: https://t.me/elecV2
[runJSFile   info][2023-01-08 14:47:54.349] run test.js result: elecV2P test done

2.代理服务器为elecv2p,网络请求使用http协议
image

[AnyProxy Log][2023-01-08 14:48:19]: received request to: GET www.sina.com/
[eV2Proxy    info][2023-01-08 14:48:20.086] http://www.sina.com/ response match rule: ^https?://www.sina.com test.js from rewrite 
[runJSFile notify][2023-01-08 14:48:20.089] run test.js from rewriteRes
[test.js     info][2023-01-08 14:48:20.110] hello elecV2P, nice to meet you!
[test.js     info][2023-01-08 14:48:20.113] current version 3.7.5
[test.js     info][2023-01-08 14:48:20.114] Project: https://github.com/elecV2/elecV2P
[test.js     info][2023-01-08 14:48:20.114] Docs: https://github.com/elecV2/elecV2P-dei
[test.js     info][2023-01-08 14:48:20.114] telegram channel: https://t.me/elecV2
[runJSFile   info][2023-01-08 14:48:20.116] run test.js result: elecV2P test done
[AnyProxy Log][2023-01-08 14:48:20]: received request to: GET www.sina.com/favicon.ico
[eV2Proxy    info][2023-01-08 14:48:20.840] http://www.sina.com/favicon.ico response match rule: ^https?://www.sina.com test.js from rewrite 
[runJSFile notify][2023-01-08 14:48:20.842] run test.js from rewriteRes
[test.js     info][2023-01-08 14:48:20.883] hello elecV2P, nice to meet you!
[test.js     info][2023-01-08 14:48:20.884] current version 3.7.5
[test.js     info][2023-01-08 14:48:20.885] Project: https://github.com/elecV2/elecV2P
[test.js     info][2023-01-08 14:48:20.886] Docs: https://github.com/elecV2/elecV2P-dei
[test.js     info][2023-01-08 14:48:20.886] telegram channel: https://t.me/elecV2
[runJSFile   info][2023-01-08 14:48:20.893] run test.js result: elecV2P test done

3.代理服务器为clashmeta,分流至elecv2p,网络请求使用http协议
image

[AnyProxy Log][2023-01-08 14:50:54]: received https CONNECT request www.sina.com
[AnyProxy Log][2023-01-08 14:50:54]: will bypass the man-in-the-middle proxy

希望可以得到帮助,谢谢

@elecV2
Copy link
Owner

elecV2 commented Jan 9, 2023 via email

@yuukh
Copy link
Author

yuukh commented Jan 9, 2023

改为网络请求前,重写依然未生效,测试结果和产生的日志与例三一模一样
image

clashmeta可以看到请求类型是http,且请求发送给了elecv2p
image

@elecV2
Copy link
Owner

elecV2 commented Jan 9, 2023 via email

@yuukh
Copy link
Author

yuukh commented Jan 9, 2023

把一级代理换为tinyproxy就不会出现这个问题了,是clashmeta的问题,http类型的连接向上游传递时不应该使用connect方法

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

No branches or pull requests

2 participants