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

Oh no! We couldn't connect to HTTP Toolkit. Is it running, and connected to the same network as this device? #11

Closed
thorbn opened this issue Apr 25, 2023 · 5 comments

Comments

@thorbn
Copy link

thorbn commented Apr 25, 2023

Hello. Whenever I launch the Android app and try connecting it to my Windows machine (which is on the same network) I get the error stated in the title. I haven't found myself having any issues with other apps. I have a Xiaomi Note 11 running Android version 11 RKQ1.200826.002 and MIUI-Version MIUI Global 12.5.7 Stable 12.5.7.0(RKFEUXM). My phone isn't rooted.
If you guys need any more info from me I would be happy to provide it.

@pimterry
Copy link
Member

Thanks @thorbn. When this happens, does anything appear on the 'View' page on your computer? If the phone can connect to your computer, there should be at least one http://android.httptoolkit.tech/config request there that's sent during setup.

@thorbn
Copy link
Author

thorbn commented Apr 25, 2023

Hello. There is nothing appearing in the "View" tab on my computer. I don't get anything on my computer, just the error message on my phone.

@pimterry
Copy link
Member

Ok, it's almost certain that there's some kind of connectivity issue in that case. At this stage the app is sending an HTTP request to your computer on your proxy port (8000, by default) testing each of your computer's IP addresses to see how to connect, and it's not arriving on any of them.

There's lots of things that can cause this unfortunately. Some networks don't allow connectivity between local devices, which would do this, as would a firewall on your computer that blocks all connections to that port.

You can test connectivity by trying to open http://<your computer's IP>:8000/ in a browser on your device. If you can connect, you should see a request appear on the View page, and see a response appear in the browser on your phone (typically a message like 'Passthrough loop detected' unless you've added a custom rule, because you're not really supposed to make direct requests to the proxy). In this case though, you'll probably see an error that may tell you more about the connectivity issues.

If none of that comes up with any clues, you can also try looking at the raw logs from the device. Those are available via ADB with adb logcat -T1, and you'll see messages in there like:

tech.httptoolkit.android.MainActivity: Connecting to VPN from URL: https://android.httptoolkit.tech/connect/?data=...
tech.httptoolkit.android.ProxySetup: URL data is {"addresses":["$IP", "$ANOTHER_IP"],"port":8000,"localTunnelPort":8000,"certFingerprint":"QWEASDQWEASDqweasdqweasd="}
tech.httptoolkit.android (kotlinx.coroutines.SupervisorCoroutine): Validating proxy info ProxyInfo(addresses=[$IP, $ANOTHER_IP], port=8000, localTunnelPort=8000, certFingerprint=QWEASDQWEASDqweasdqweasd=)
tech.httptoolkit.android (kotlinx.coroutines.SupervisorCoroutine): Proxy tests started
tech.httptoolkit.android (kotlinx.coroutines.UndispatchedCoroutine): Testing proxy $IP:8000
tech.httptoolkit.android (kotlinx.coroutines.UndispatchedCoroutine): Testing proxy $ANOTHER_IP:8000
tech.httptoolkit.android (kotlinx.coroutines.UndispatchedCoroutine): Error testing proxy address $IP: java.net.ConnectException: Failed to connect to $IP
tech.httptoolkit.android (kotlinx.coroutines.UndispatchedCoroutine): Error testing proxy address $ANOTHERIP: java.net.SocketTimeoutException: connect timed out

That will at least tell you exactly what IPs were used, and what the connection errors are. It's also technically possible something else could be failing here and causing this behaviour, and that will be listed in here if so, but I've never seen anything but connectivity problems cause cases like this so I'd be pretty surprised.

@thorbn
Copy link
Author

thorbn commented Apr 25, 2023

Thanks for your help. I deactivated all firewalls that could be causing this and now it's working!

@pimterry
Copy link
Member

Excellent! I'll close this now, glad that sorted it for you 👍

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