README.md
# ublproxy A network-wide adblock proxy-server w. adblock list support, custom rules and passkey users. Easy to set up and host yourself. ## Problem domain Browsers were supposed to be "user-agents", but modern browsers are far more catered to ad-selling corporations, than they are to users. Existing solutions, such as [pihole](https://pi-hole.net/) and other dns-based solutions are only sufficient, if you want to block an entire hostname. Browser extensions used to work well, but with the latest [Manifest changes](https://adlock.com/blog/chrome-killing-adblock/), they are not as effective as they used to be. ## Architecture ublproxy sits between your devices and the internet, intercepting HTTP/HTTPS traffic to block ads and tracking at the network level. ```mermaid graph LR subgraph LAN["Local Network"] D1["Desktop"] D2["Laptop"] D3["Phone"] end subgraph UBL["ublproxy"] HTTP[":8080<br/>HTTP"] HTTPS[":8443<br/>HTTPS"] BL["Blocklist<br/>Engine"] CA["CA + Cert<br/>Cache"] DB["SQLite<br/>Store"] end UP["Upstream<br/>Servers"] D1 --> HTTPS D2 --> HTTPS D3 --> HTTP HTTPS --> BL HTTP --> BL BL --> CA BL --> UP HTTPS --> DB ``` The proxy operates in one of two modes: ### Explicit proxy mode (default) Browsers are configured to send traffic through the proxy via PAC files or manual proxy settings. ```mermaid sequenceDiagram participant B as Browser participant P as ublproxy participant U as Upstream B->>P: CONNECT example.com:443 P->>P: Check blocklist alt Blocked P-->>B: 403 Forbidden else Excepted (@@) P->>U: TCP tunnel (passthrough) U-->>B: Direct TLS (no MITM) else Normal P-->>B: 200 OK B->>P: TLS handshake (MITM cert) P->>P: Generate cert for example.com B->>P: GET /page P->>U: GET /page (real TLS) U-->>P: HTML response P->>P: Strip blocked resources P->>P: Inject ele…