HeaderGatePlugin is a per-route .NET plugin for the titanium CLI. It answers 403 when a request lacks one header and stamps another request header on the requests it lets through.
dotnet build -c ReleaseCopy bin/Release/net10.0/Titanium.Web.Proxy.Examples.RoutePlugin.dll next to your twp.yaml and add:
plugins:
- name: header-gate
assembly: ./Titanium.Web.Proxy.Examples.RoutePlugin.dll
settings:
requiredHeader: X-Api-Client
stampHeader: X-Route-Plugin
failMode: closed
timeoutMs: 200
routes:
- id: api
clusterId: backend
match: { path: /api, pathKind: Prefix }
middleware: [header-gate]Only /api runs the plugin. Every other route is unchanged.
[ProxyPlugin(ProxyPluginContract.CurrentVersion)]declares the contract version the plugin was built for.- The constructor takes the
settingsmap. - The project references
Titanium.Web.Proxy.AbstractionsandTitanium.Web.ProxywithPrivate=falseandExcludeAssets=runtime, so the host's own copies are the ones the plugin uses.
The full guide is in website/docs/plugins.md.