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

ERR_CONNECTION_RESET on android emulator #6803

Open
andersonvom opened this issue Apr 16, 2024 · 2 comments
Open

ERR_CONNECTION_RESET on android emulator #6803

andersonvom opened this issue Apr 16, 2024 · 2 comments
Labels
kind/triage Unclassified issues

Comments

@andersonvom
Copy link
Contributor

Problem Description

Setting up mitmproxy on a default android-33 emulator always yields a connection reset error, regardless of HTTP or HTTPS.

Steps to reproduce the behavior:

  1. Create emulator:
    avdmanager create avd --name mitm --package 'system-images;android-33;default;arm64-v8a' -c 2048M -d pixel --force
  2. Add CA certificate following instructions on Install System CA Certificate on Android Emulator
  3. Start mitmproxy: mitmproxy
  4. Configure android proxy
  5. Visit any page (either http or https)

Expected behavior: traffic should flow through mitmproxy.
Actual behavior: ERR_CONNECTION_RESET.
Notes:

  1. I can see the mitmproxy system CA certificate listed under Trusted credentials
  2. http://mitm.it also yields the same ERR_CONNECTION_RESET error.
  3. Quitting mitmproxy and trying to make requests again yields ERR_PROXY_CONNECTION_FAILED, which means the connection seems to be going through the proxy.
  4. Turning off the proxy settings on the emulator makes pages load again (without flowing through mitmproxy, of course).

The event logs only show the client connecting/disconnecting:

Events
info: [10:54:07.496] HTTP(S) proxy listening at *:8080.
info: [10:54:33.817][192.168.68.117:60531] client connect
info: [10:54:33.829][192.168.68.117:60531] client disconnect

System Information

$ mitmproxy --version
Mitmproxy: 10.2.4 binary
Python:    3.12.2
OpenSSL:   OpenSSL 3.2.1 30 Jan 2024
Platform:  macOS-14.2.1-arm64-arm-64bit
@andersonvom andersonvom added the kind/triage Unclassified issues label Apr 16, 2024
@mhils
Copy link
Member

mhils commented Apr 17, 2024

What happens if you run with --set proxy_debug -vvv ?

@andersonvom
Copy link
Contributor Author

Do you mean mitmproxy --set proxy_debug -vvv? If so, nothing really happened: I'm still not able to connect and I only see the exact same log entries:

info: [16:11:12.457] HTTP(S) proxy listening at *:8080.
info: [16:11:16.141][192.168.68.117:55893] client connect
info: [16:11:16.143][192.168.68.117:55893] client disconnect

For what it's worth, I just learned about android's 10.0.2.2 magic IP address, which does make the proxy work. Now I'm not sure if this problem is on the android side or mitmproxy. On one hand, the proxy works with the magic IP, but on the other hand, I can reach my local IP address from the emulator just the same (i.e. without any proxy settings, I can visit my local ip on a browser and make successful requests), so the network seems fine. 🤷

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

No branches or pull requests

2 participants