How to make only one domain pass through the proxy?

Greetings ! :disappointed_relieved:

Idea:

In the middle of all traffic passing through the proxy, only when a domain is accessed does the sniff. If it is not the domain “http://example.org/”, the sites can be processed without interception action.

Code:

import mitmproxy

address = "example.org"

def request(flow):
         if flow.request.host != address:
               print("THIS FLOW IS TRASH")
               make_disconnect_request(address)

def make_disconnect_request(address):
    return HTTPRequest(
        "authority", b"DISCONNECT", None, None, None, None, b"HTTP/1.1",
        http.Headers(), b""
    )

I know that sending a request asking to disconnect will not cause the other domains to stop going through the proxy, but the idea is to make those who do not act or even process the requests, they just follow their normal traffic as if they were not being sniffed.

Sry my english, i’m brazilian.
Thanks!