# alexashley/kong-plugin-path-prefix architecture

> Architecture diagram of the GitHub repository alexashley/kong-plugin-path-prefix, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alexashley/kong-plugin-path-prefix
- Repository: https://github.com/alexashley/kong-plugin-path-prefix

## Overview

This is a small Kong plugin that removes a configured shared path prefix from requests before they reach an upstream service. It can also add an X-Forwarded-Prefix header. The README documents these behaviors and the plugin’s configuration; source excerpts were unavailable, so the graph shows only those documented relationships.

Main entry points: [`kong/plugins/path-prefix/handler.lua`](https://github.com/alexashley/kong-plugin-path-prefix/blob/master/kong/plugins/path-prefix/handler.lua) (Path rewrite)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["Kong plugin"]
  node_handler["Path rewrite<br/>[handler.lua]"]
  node_schema["Plugin schema<br/>[schema.lua]"]
end

node_client(("Request client"))
node_kong(("Kong"))
node_upstream(("Upstream service"))

node_client -->|"sends request"| node_kong
node_kong -->|"dispatches"| node_handler
node_handler -->|"rewrites path"| node_upstream
node_handler -.->|"adds optional header"| node_upstream

click node_handler "https://github.com/alexashley/kong-plugin-path-prefix/blob/master/kong/plugins/path-prefix/handler.lua"
click node_schema "https://github.com/alexashley/kong-plugin-path-prefix/blob/master/kong/plugins/path-prefix/schema.lua"

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_handler,node_schema,node_client toneBlue
class node_kong,node_upstream toneIndigo
```

## Components

### Kong plugin

- [Path rewrite](https://github.com/alexashley/kong-plugin-path-prefix/blob/master/kong/plugins/path-prefix/handler.lua): `kong/plugins/path-prefix/handler.lua`
- [Plugin schema](https://github.com/alexashley/kong-plugin-path-prefix/blob/master/kong/plugins/path-prefix/schema.lua): `kong/plugins/path-prefix/schema.lua`

### Other components

- **Request client**
- **Kong**
- **Upstream service**

## Connections

- Request client → Kong: sends request
- Kong → Path rewrite: dispatches
- Path rewrite → Upstream service: rewrites path
- Path rewrite → Upstream service: adds optional header
