<div align="center">
# hyperlane-plugin-rewrite
**High-Performance HTTP URL Rewrite & Redirect Middleware Plugin**
[](https://crates.io/crates/hyperlane-plugin-rewrite)
[](https://docs.rs/hyperlane-plugin-rewrite)
[](https://www.rust-lang.org)
[](../../LICENSE)
[Workspace Overview](../../README.md) · [Plugin Catalog](../README.md) · [API Docs](https://docs.rs/hyperlane-plugin-rewrite/latest/)
</div>
---
## Overview
Opt-in request middleware (order `-102`) providing canonical host & HTTPS upgrade redirects (`X-Forwarded-Proto` and RFC 7239 `Forwarded` aware), duplicate-slash collapsing, trailing-slash normalization (`Strip`/`Enforce`), `O(1)` `XxHash3_64` static exact redirect/rewrite tables, segment-bounded prefix strip/rewrite rules, and precompiled regex rules supporting both short-circuit HTTP redirects (`301`/`302`/`307`/`308`) and internal `Request::set_path` rewrites.
This crate is a member of the [`hyperlane`](../../README.md) unified Rust 2024 workspace. All plugin crates are opt-in and transparent (`Status::Continue`) when unconfigured.
## Responsibilities & Module Layout
- `struct` / `enum` / `impl` — `RewriteConfig`, `RedirectStatus`, `RewriteAction`, `TrailingSlashMode`, `CompiledRewrite`, `RewritePlugin`, and `RewriteHook` (`-102`)
- `fn` — Zero-allocation duplicate-slash check, host/proto extraction, CRLF-safe `Location` assembly, and segment-boundary prefix matching
## Installation
```sh
cargo add hyperlane-plugin-rewrite
```
## Verification
Run crate-scoped formatting, lint, and test gates from the workspace root:
```sh
cargo run -p hyperlane-cli -- fmt --check
cargo clippy -p hyperlane-plugin-rewrite --all-features --all-targets -- -D warnings
cargo test -p hyperlane-plugin-rewrite --all-features
```
## Documentation & Governance
- Project standards and release workflows live in [`../../.agents/skills/hyperlane/SKILL.md`](../../.agents/skills/hyperlane/SKILL.md).
## License
This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for details.
## Contact
For inquiries, please contact the author at [root@devhub.vip](mailto:root@devhub.vip).