# bbik52/miniproxy architecture

> Architecture diagram of the GitHub repository bbik52/miniproxy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bbik52/miniproxy
- Repository: https://github.com/bbik52/miniproxy

## Overview

miniProxy is a single-file PHP web proxy: a browser supplies a destination URL, the script validates and forwards the request, then returns the response, rewriting web content so supported links and forms continue through the proxy. The excerpt shows URL policy checks, cURL forwarding, HTML/CSS URL rewriting, and injected XMLHttpRequest handling. The README documents the proxy’s purpose and limitations; omitted source prevents confirming details beyond those visible in the excerpt.

Main entry points: [`miniProxy.php`](https://github.com/bbik52/miniproxy/blob/master/miniProxy.php) (Request entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_request["Request handling"]
  node_entry["Request entry<br/>[miniProxy.php]"]
  node_policy["URL policy<br/>[miniProxy.php]"]
end

subgraph group_proxy["Proxy transport"]
  node_forward["HTTP forwarding<br/>[miniProxy.php]"]
end

subgraph group_rewrite["Response rewriting"]
  node_rewrite["HTML rewriting<br/>[miniProxy.php]"]
  node_urlrewrite["URL and CSS rewriting<br/>[miniProxy.php]"]
  node_ajax["XHR interception<br/>[miniProxy.php]"]
end

node_browser(("Browser"))
node_destination["Destination site"]

node_browser -->|"sends request"| node_entry
node_entry -->|"validates URL"| node_policy
node_entry -->|"forwards request"| node_forward
node_forward -->|"HTTP request"| node_destination
node_destination -->|"returns response"| node_forward
node_entry -->|"rewrites response"| node_rewrite
node_rewrite -->|"rewrites URLs"| node_urlrewrite
node_rewrite -->|"injects handler"| node_ajax
node_entry -->|"outputs response"| node_browser

click node_entry "https://github.com/bbik52/miniproxy/blob/master/miniProxy.php"
click node_policy "https://github.com/bbik52/miniproxy/blob/master/miniProxy.php"
click node_forward "https://github.com/bbik52/miniproxy/blob/master/miniProxy.php"
click node_rewrite "https://github.com/bbik52/miniproxy/blob/master/miniProxy.php"
click node_urlrewrite "https://github.com/bbik52/miniproxy/blob/master/miniProxy.php"
click node_ajax "https://github.com/bbik52/miniproxy/blob/master/miniProxy.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_policy,node_browser toneBlue
class node_forward toneAmber
class node_rewrite,node_urlrewrite,node_ajax toneMint
class node_destination toneIndigo
```

## Components

### Request handling

- [Request entry](https://github.com/bbik52/miniproxy/blob/master/miniProxy.php): `miniProxy.php`
- [URL policy](https://github.com/bbik52/miniproxy/blob/master/miniProxy.php): `miniProxy.php`

### Proxy transport

- [HTTP forwarding](https://github.com/bbik52/miniproxy/blob/master/miniProxy.php): `miniProxy.php`

### Response rewriting

- [HTML rewriting](https://github.com/bbik52/miniproxy/blob/master/miniProxy.php): `miniProxy.php`
- [URL and CSS rewriting](https://github.com/bbik52/miniproxy/blob/master/miniProxy.php): `miniProxy.php`
- [XHR interception](https://github.com/bbik52/miniproxy/blob/master/miniProxy.php): `miniProxy.php`

### Other components

- **Browser**
- **Destination site**

## Connections

- Browser → Request entry: sends request (evidence: `README.md`)
- Request entry → URL policy: validates URL (evidence: `miniProxy.php`)
- Request entry → HTTP forwarding: forwards request (evidence: `miniProxy.php`)
- HTTP forwarding → Destination site: HTTP request (evidence: `miniProxy.php`)
- Destination site → HTTP forwarding: returns response (evidence: `miniProxy.php`)
- Request entry → HTML rewriting: rewrites response (evidence: `miniProxy.php`)
- HTML rewriting → URL and CSS rewriting: rewrites URLs (evidence: `miniProxy.php`)
- HTML rewriting → XHR interception: injects handler (evidence: `miniProxy.php`)
- Request entry → Browser: outputs response (evidence: `miniProxy.php`)
