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
Upstream HTTPS #2253
Comments
The error messages indicates that it can't resolve |
@Kriechi Sorry, maybe I didn't explain well enough. The issue is that it shouldn't be using default_proxy at all. Look at the code, the proxy should always get changed to a different one. So the one I'm passing on the command line should be irrelevant. |
This is not true for the initial CONNECT request: https://gist.github.com/JakeAustwick/c3116d86f4483d1acede4420f02efb72#file-proxy-py-L21-L22 |
@mhils I tried it without that line too; same issue. I actually only have those lines because they were from an online example. Is there some kind of technical reason why I need those two lines, and the CONNECT can't go through one of my upstream proxies? |
The example has a comment explaining this: https://github.com/mitmproxy/mitmproxy/blob/master/examples/complex/change_upstream_proxy.py |
@mhils The comment suggests that doing this is only required if I need access to the request data to make the proxy choice, right? I have the same issue with the following code though, with the CONNECT line removed (because I'm just using a random proxy, no request data needed). https://gist.github.com/JakeAustwick/af0bc5a5052b2ff8ec423a9c6ca49b97 |
If you don't redirect before the CONNECT request, said request will be sent to the default server. Whatsoever, looking at the code, this won't fix your problem. We always establish a connection with the default host here. I'm not exactly sure why that is the case, just calling |
I also posted this on Discourse, but I'm posting it here because I believe it to be a bug.
I have my script changing the upstream proxy for HTTP connections, but it seems to fail for HTTPS connections. Here's a basic stripped down example.
https://gist.github.com/JakeAustwick/c3116d86f4483d1acede4420f02efb72
The script works fine for http://api.ipify.org/, but fails for https://api.ipify.org/. With HTTPS I see the following, which shows the upstream proxy wasn't changed.
Server connection to default_proxy:8888 failed: Error connecting to "default_proxy": [Errno 8] nodename nor servname provided, or not known
Running Command:
mitmdump -s utilities/proxy_redirects.py -U http://default_proxy:8888
Platform / Library Version ( I also tested on Ubuntu):
The text was updated successfully, but these errors were encountered: