I’m trying to return a response for a URL that only exists on a VPN, while I’m not connected to the VPN. When I’m not on the VPN the request times out, but I have a mock response to return for the request, but the response(flow): is not called.
In the docs under HTTP Events -> http_connect(flow), it says:
“Called when we receive an HTTP CONNECT request. Setting a non 2xx response on the flow will return the response to the client abort the connection. CONNECT requests and responses do not generate the usual HTTP handler events. CONNECT requests are only valid in regular and upstream proxy modes.”
I’ve tried setting a mitmproxy.http.HTTPResponse object on the flow with an http status of 200, but it doesn’t seem to do anything.
Am I going down the right path? And is there a way to accomplish this?