简体   繁体   English

在android上https到http反向代理应用程序?

[英]https to http reverse proxy app on android?

I am trying to set up a solution to allow full debugging of javascript code directly on an Android tablet. 我正在尝试设置一个解决方案,允许直接在Android平板电脑上完整调试javascript代码。 This is an HTML5 app running in a standard mobile browser such as Chrome or Firefox that needs debugging. 这是一个在标准移动浏览器(如Chrome或Firefox)中运行的HTML5应用,需要调试。 By "full" I mean that the ability to set breakpoints and step through the code (in,over,out) is required. “完全”是指需要设置断点并逐步执行代码(in,over,out)的能力。

Being able to debug directly on the device is important for cases in the field where a PC to debug remotely with is not available. 能够直接在设备上进行调试对于远程调试的PC不可用的现场情况非常重要。 At some point the ability to debug offline capable web apps will be needed, where the proxy server will not have to do anything, assuming the front end code has already been loaded into the browser and/or cached on the device before losing the network connection, but that is not the focus of this question. 在某些时候,将需要调试具有脱机功能的Web应用程序的能力,代理服务器将不必执行任何操作,假设前端代码已经加载到浏览器中和/或在丢失网络连接之前缓存在设备上,但这不是这个问题的焦点。

I was able to get a Weinre solution working, but discovered that Weinre does not have the capability of setting breakpoints or stepping through code. 我能够得到一个Weinre解决方案,但发现Weinre没有设置断点或单步执行代码的能力。 Then I discovered the jsHybugger app, a for-pay product which I can run on the tablet, which proxies request to the server and then serves up a debugging interface which I can actually view using a different browser tab on the same android tablet device. 然后我发现了jsHybugger应用程序,一个付费产品,我可以在平板电脑上运行,代理请求到服务器,然后提供调试界面,我可以使用同一Android平板设备上的不同浏览器选项卡实际查看。

The piece that I am missing is that jsHybugger does not support https, and therefore will not talk to the server that is serving up the code to be debugged. 我遗漏的部分是jsHybugger不支持https,因此不会与提供要调试的代码的服务器通信。 It is important to use https and not http because sensitive information is being passed between the server and the browser. 使用https而不是http非常重要,因为在服务器和浏览器之间传递敏感信息。 Since the debugging is occurring in the field it is not like it is on a LAN where lack of https is not so critical. 由于调试是在现场进行的,因此不像在局域网上缺少https并不那么重要。 It is always possible to do some debugging in a more controlled setting, but inevitably errors will occur in the field which require "emergency debugging" using real (not dummy or sanitized for http) data. 总是可以在更受控制的设置中进行一些调试,但是在现场中不可避免地会发生错误,这需要使用真实(非虚拟或消毒的http)数据进行“紧急调试”。

I know that there are reverse proxies that are out there - for instance I can reverse proxy https to http in apache very easily. 我知道有反向代理 - 例如我可以很容易地将代理https反向到apache中的http。 But the problem is, since the connection between the tablet and the server needs to be encrypted, I can't do the proxying on the server, and since another (non-Android) device is not always available, I need to do it on the tablet. 但问题是,由于平板电脑和服务器之间的连接需要加密,我不能在服务器上进行代理,而且由于另一个(非Android)设备并不总是可用,我需要在平板电脑。 And so far, I have not found any apps out there that obviously look like they will do what I need. 到目前为止,我还没有发现任何应用程序显然看起来他们会做我需要的。 For instance, I have look at i-Jetty, since I have read that Jetty (upon which it is based) can do what I am looking for, but all the examples I see on proxying are Java code, and I would like to avoid needing to write any code myself for this. 例如,我看过i-Jetty,因为我已经读过Jetty(基于它)可以做我正在寻找的东西,但我在代理上看到的所有例子都是Java代码,我想避免需要为此自己编写任何代码。 I have also looked at Fiddler, but it doesn't appear to run on Android, despite the bold claim that it is "The free web debugging proxy for any browser, system or platform". 我也看过Fiddler,但它似乎没有在Android上运行,尽管大胆宣称它是“任何浏览器,系统或平台的免费网络调试代理”。 Obviously the claim that "Fiddler is here to help, no matter what platform or language you use to develop!" 显然,无论您使用什么平台或语言开发,“Fiddler都会随时为您提供帮助!” is false in this case. 在这种情况下是错误的。 I have also looked at various apps in the Google Play store, without finding anything. 我还查看了Google Play商店中的各种应用,却没有找到任何内容。 Perhaps this feature just isn't advertised prominently, and I have missed it. 也许这个功能并没有突出显示,我错过了它。 Hopefully there is some app out there already that does what I need with a minimum of config fiddling. 希望有一些应用程序已经做了我需要的最少的配置摆弄。 Ideally it doesn't require root; 理想情况下它不需要root; if it does it isn't a show-stopper, but it's less preferred as rooting just to be able to debug can be a hassle as nothing else we do requires it, and some devices are more fiddly to root than others. 如果它确实不是一个显示停止,但它不太优选作为生根只是为了能够调试可能是一个麻烦,因为我们没有其他任何需要它,并且一些设备比其他设备更加繁琐。

Alternately, if there is a better way to accomplish what I am trying to do, I will accept that as an answer instead. 或者,如果有更好的方法来完成我想要做的事情,我会接受这个作为答案。

As you mentioned that your development is mostly on SDK, I think an option available you can find for debugging is the Dalvik Debug Monitor Server (DDMS). 正如您所提到的,您的开发主要是在SDK上,我认为您可以找到可供调试的选项是Dalvik Debug Monitor Server(DDMS)。 It is quoted as one of the most powerful Android debugging tools out there is the Dalvik Debug Monitor Server. 它被称为最强大的Android调试工具之一,有Dalvik Debug Monitor Server。

Specifically for HTTPS, Google App Engine provides the feature as a HTTP / HTTPS proxy that you are interested: gae-go-testing . 特别是对于HTTPS,Google App Engine将此功能作为您感兴趣的HTTP / HTTPS代理提供:gae-go-testing。 Have a look in this open source project also available on Github, that seems to take advantage of some tools from Google App Engine, which is also available at Google Play as a released App. 看看Github上也可以使用的这个开源项目,它似乎可以利用Google App Engine中的一些工具,这些工具也可以在Google Play上作为已发布的应用程序使用。

As an alternative, you might consider to run the application in the development server and use Selenium to also perform your tests. 作为替代方案,您可以考虑在开发服务器中运行该应用程序,并使用Selenium来执行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM