hyperlane-plugin-rewrite 23.0.0

A high-performance HTTP URL rewrite and redirect plugin for the Hyperlane framework featuring canonical host/HTTPS enforcement (X-Forwarded-Proto aware), trailing-slash and duplicate-slash normalization, O(1) XxHash3_64 static tables, segment-bounded prefix rules, and compiled regex rules.
Documentation
<div align="center">

# hyperlane-plugin-rewrite

**High-Performance HTTP URL Rewrite & Redirect Middleware Plugin**

[![crates.io](https://flat.badgen.net/crates/v/hyperlane-plugin-rewrite)](https://crates.io/crates/hyperlane-plugin-rewrite)
[![docs.rs](https://img.shields.io/docsrs/hyperlane-plugin-rewrite?style=flat-square)](https://docs.rs/hyperlane-plugin-rewrite)
[![Rust 2024](https://img.shields.io/badge/edition-2024-orange.svg?style=flat-square)](https://www.rust-lang.org)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](../../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).