Redirect Rule Input

Redirect Rule Input is a copy-paste React component that stops redirect loop broke the site before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/redirect-rule-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsRedirect loop broke the site

Was this component page useful?

How do I install Redirect Rule Input?

pnpm dlx shadcn@latest add @bollard/redirect-rule-input

The files land in your project. They're yours to edit.

How do I use Redirect Rule Input in React?

redirect-rule-input-usage.tsx
import { RedirectRuleInput } from "@/components/ui/redirect-rule-input"

<RedirectRuleInput key={example} value={value} onValueChange={setValue} origin="https://example.com" />

What input mistakes does Redirect Rule Input catch?

  • Loops and 2+ hop chains, with the hop path
  • Rules shadowed by an earlier wildcard
  • Open redirects whose destination host comes from the request
  • 301/308 on temporary moves and 301/302 turning POST into GET
  • Dropped query strings, ?query or #hash in the source, missing leading slash, unmatched placeholders
  • Trailing-slash traps and hops to http

What props does Redirect Rule Input accept?

RedirectRuleInput props
PropTypeDefault
value

Controlled rules text.

string—
defaultValue

Initial rules text when uncontrolled.

string""
onValueChange

Called with the new text on every edit or fix.

(value: string) => void—
format

Force a format instead of detecting it from the pasted text.

RedirectFormat—
origin

Your site's origin, used for paths without a host. Default https://example.com.

string—
hosts

Other hostnames of the same site (www, apex, old domains), so hops between them are followed.

string[]—
defaultTraceUrl

URL the tester starts with. Defaults to an example from the first loop or chain.

string—
defaultTraceMethod

Method the tester starts with.

RedirectMethod"GET"
temporaryPattern

Paths that look like temporary moves. Defaults to TEMPORARY_PATTERN (sale, promo, maintenance, beta…).

RegExp—
postPattern

Paths likely to receive POSTs. Defaults to POST_PATTERN (api, webhook, checkout, form…).

RegExp—
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{detail}`, `{line}`, `{to}`, `{status}`, `{count}`, `{format}` are filled in.

Partial<RedirectRuleInputMessages>—

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

How is Redirect Rule Input accessible?

  • Visible <label> on the textarea; aria-invalid when errors exist and status wired via aria-describedby
  • Issue count is a role=status region
  • GET/POST tester is a roving-tabindex radiogroup operated with arrow keys
  • After a fix, focus moves to the next fix button or back to the textarea
  • Hop outcomes shown with icons and text

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Validate redirect destinations against an allowlist on the server; this checks config text, not live traffic.

  • Models each platform from its docs; framework middleware, headers/has conditions and server config elsewhere are not evaluated
  • nginx support covers rewrite/return and location selection, not every module or include
  • Open-redirect detection is pattern-based; review any destination built from user input

What validation rules apply to Redirect Rule Input?

Rules last verified:

Confirmed on Vercel (permanent defaults to true = 308, source is case-sensitive) and Netlify (default 301, 307 unsupported, query passed for 200/301/302, trailing slash ignored when matching). nginx behaviour not re-checked this round. Platforms change; check their docs. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does Redirect Rule Input stop?

Redirect loop broke the site

Also known as

redirects · vercel.json · netlify _redirects · nginx · 301 · 308 · seo · rewrite rules

Field type

What dependencies does Redirect Rule Input require?

Redirect Rule Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameRedirect Rule Input
Registry identifier@bollard/redirect-rule-input
Install commandnpx shadcn@latest add @bollard/redirect-rule-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Redirect Rule Input

What form validation mistake does Redirect Rule Input catch?

Redirect Rule Input prevents redirect loop broke the site. Catches redirect rules that loop, chain, shadow each other, open-redirect, drop queries or switch POST to GET, modelled on how each platform matches. Catches: Loops and 2+ hop chains, with the hop path, Rules shadowed by an earlier wildcard, Open redirects whose destination host comes from the request, 301/308 on temporary moves and 301/302 turning POST into GET, Dropped query strings, ?query or #hash in the source, missing leading slash, unmatched placeholders, Trailing-slash traps and hops to http. Limitation: validate redirect-rule-input schemas on backend.

How do I install redirect-rule-input with shadcn?

Run `npx shadcn@latest add @bollard/redirect-rule-input`. Sources added: registry/default/redirect-rule-input/redirect-rule-input.tsx, registry/default/redirect-rule-input/redirects.ts. Package requirements: lucide-react.

What props customize Redirect Rule Input?

Redirect Rule Input accepts `value`, `defaultValue`, `onValueChange`, `format`, `origin`. Configures redirects, vercel.json, netlify _redirects behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of redirect-rule-input?

Models each platform from its docs; framework middleware, headers/has conditions and server config elsewhere are not evaluated. nginx support covers rewrite/return and location selection, not every module or include. Open-redirect detection is pattern-based; review any destination built from user input Server requirement: Validate redirect destinations against an allowlist on the server; this checks config text, not live traffic.

How does Redirect Rule Input meet accessibility guidelines?

Visible <label> on the textarea; aria-invalid when errors exist and status wired via aria-describedby. Issue count is a role=status region. GET/POST tester is a roving-tabindex radiogroup operated with arrow keys. After a fix, focus moves to the next fix button or back to the textarea. Hop outcomes shown with icons and text. Minimizes errors: redirect loop, redirect chain seo.

Which components pair with Redirect Rule Input?