-
-
Notifications
You must be signed in to change notification settings - Fork 580
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
Modify proxy response for certain urls #1464
Comments
??? |
approach is to write your own plugin (look at the hooks available here) NOTE: selective https interception seems broken in proxypy at the moment in case you would need to change https requests |
Thanks, I'll check that out. When I was trying with https urls it works but I only seem to receive CONNECT request methods. |
and whenever I try to edit the requests i get |
We have following examples on how to modify request/response, does none of these help? Note that, when you modify body of the responses, you must also modify necessary headers as per new body e.g. content length, content type etc https://github.com/abhinavsingh/proxy.py?tab=readme-ov-file#modifypostdataplugin |
I only receive CONNECT method when connecting to proxy with a url. |
If you see CONNECT only, it means TLS intercept is simply not working. Please make sure basic TLS interception examples are working for you before proceeding |
The tls interception examples don't seem to work for me, i generated ca-key, ca-cert and ca-signing-key from wsl then ran the program on windows. but I only receive CONNECT method requests. |
I'm getting the error [WinError 2] The system cannot find the file specified when trying to connect with a https url. |
my advice is trying to get it running on wsl first. make sure that openssl is installed in that. as a general note: you never provide the startup commands, your code, and the full stack trace. this heavily decreases the chance that somebody can help you. My guesstimate is that you dont have openssl installed or are passing the ca cert files wrong. |
PROXY CODE: class RequestPlugin(HttpProxyBasePlugin):
if name == "main":
CLIENT CODE: import requests response = requests.get('https://google.com/', proxies=proxy) What could be the problem here? |
it does not work for https urls. |
I don't see your plugin trying to modify the response. Try to modify the response chunks , try this method https://github.com/abhinavsingh/proxy.py/blob/develop/proxy/http/proxy/plugin.py#L130 , see existing examples overriding this method. Lmk. |
It doesn't work this way, curl returns
< HTTP/1.1 200 OK
|
I want to intercept the request responses and return a custom status code and response body for a list of urls.
Can someone guide me in attempting this?
The text was updated successfully, but these errors were encountered: