Tencent / nohost

基于 Whistle 实现的多账号多环境远程配置及抓包调试平台
https://nohost.pro
Other
1.4k stars 160 forks source link

不转发到 nohost的请求,不需要注入none.html #154

Open obstrux opened 1 year ago

obstrux commented 1 year ago

某些资源注入script会导致出错,

<script>
  window.__whistle_nohost_from_imweb_is_inited__ = true;
</script>
avwo commented 1 year ago

为什么注入这个会报错?

obstrux commented 1 year ago

为什么注入这个会报错?

有些三方的文件会对script进行检验,就导致出问题,所以就想能不能加一个配置来过滤

avwo commented 1 year ago

在管理后台的 Whistle 里面配置 路径 whistle.nohost://none 试试

nozbwang commented 1 year ago

在管理后台的 Whistle 里面配置 路径 whistle.nohost://none 试试

nohost version: 1.5.4

加上whistle.nohost://none之后,还是会添加脚本到html。还有其它的配置可以使用么,?可以不添加任何内容到html里。

目前添加的内容如下:

< !DOCTYPE html >

nozbwang commented 1 year ago

通过修改响应头的content-type为非text/html,临时规避了这个问题。不知道是不是有其他更优雅的解决办法,期待回复中...

临时解决方案如下:
在管理后台的 Whistle 里面配置: https://www.**.com/toolBox/code.do?type=2 resType://text

image

备注: 我们的业务场景是传递一个加密码到后台,后台再返回一串解密之后的数字到前台,然后前台保存响应中的数字在页面上。但是响应的的content-type是text/html,也是非常奇葩。

avwo commented 1 year ago

https://www.**.com/toolBox/code.do?type=2 whistle.nohost://none 不行吗

zxt5105515 commented 1 year ago

遇到了同样的问题,注入none.html后前端校验body过不去,有什么方法吗

avwo commented 1 year ago

入口规则配 -domain

zxt5105515 commented 1 year ago

不行,-domain只是不会注入whistle.nohost/inject.html,仍然会注入whistle.nohost/none.html

入口规则配 -domain

avwo commented 1 year ago

哪来的 none.html

zxt5105515 commented 1 year ago

哪来的 none.html

-domain域名的响应body开头会添加 < !DOCTYPE html >

搜nohost代码发现是在 https://github.com/Tencent/nohost/blob/master/lib/plugins/whistle.nohost/_rules.txt

avwo commented 1 year ago

这个是控制客户端插件注入的小圆点不要显示,注入也没问题不影响功能。