Const
A redirect Response that will force a document reload to the new location. Sets the status code and the Location header. Defaults to 302 Found.
Response
Location
302 Found
This utility accepts absolute URLs and can navigate to external domains, so the application should validate any user-supplied inputs to redirects.
import { redirectDocument } from "react-router";import { destroySession } from "../sessions.server";export async function action({ request }: Route.ActionArgs) { let session = await getSession(request.headers.get("Cookie")); return redirectDocument("/", { headers: { "Set-Cookie": await destroySession(session) } });} Copy
import { redirectDocument } from "react-router";import { destroySession } from "../sessions.server";export async function action({ request }: Route.ActionArgs) { let session = await getSession(request.headers.get("Cookie")); return redirectDocument("/", { headers: { "Set-Cookie": await destroySession(session) } });}
framework
data
The URL to redirect to.
The status code or a ResponseInit object to be included in the response.
ResponseInit
A Response object with the redirect status and Location header.
A redirect
Responsethat will force a document reload to the new location. Sets the status code and theLocationheader. Defaults to302 Found.This utility accepts absolute URLs and can navigate to external domains, so the application should validate any user-supplied inputs to redirects.