简体   繁体   中英

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. This is an HTML5 app running in a standard mobile browser such as Chrome or Firefox that needs debugging. By "full" I mean that the ability to set breakpoints and step through the code (in,over,out) is required.

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. 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.

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. 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.

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. It is important to use https and not http because sensitive information is being passed between the server and the browser. 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. 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.

I know that there are reverse proxies that are out there - for instance I can reverse proxy https to http in apache very easily. 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. 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 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". Obviously the claim that "Fiddler is here to help, no matter what platform or language you use to develop!" is false in this case. I have also looked at various apps in the Google Play store, without finding anything. 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; 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). It is quoted as one of the most powerful Android debugging tools out there is the 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 . 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.

As an alternative, you might consider to run the application in the development server and use Selenium to also perform your tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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