OptionalallowedAn array of allowed origin hosts for action submissions to UI routes (does not apply
to resource routes). Supports micromatch glob patterns (* to match one segment,
** to match multiple).
export default {
allowedActionOrigins: [
"example.com",
"*.example.com", // sub.example.com
"**.example.com", // sub.domain.example.com
],
} satisfies Config;
If you need to set this value at runtime, you can do in by setting the value
on the server build in your custom server. For example, when using express:
import express from "express";
import { createRequestHandler } from "@react-router/express";
import type { ServerBuild } from "react-router";
export const app = express();
async function getBuild() {
let build: ServerBuild = await import(
"virtual:react-router/server-build"
);
return {
...build,
allowedActionOrigins:
process.env.NODE_ENV === "development"
? undefined
: ["staging.example.com", "www.example.com"],
};
}
app.use(createRequestHandler({ build: getBuild
OptionalappThe path to the app directory, relative to the root directory. Defaults
to "app".
OptionalbasenameThe React Router app basename. Defaults to "/".
OptionalbuildThe path to the build directory, relative to the project. Defaults to
"build".
OptionalbuildA function that is called after the full React Router build is complete.
OptionalfutureEnabled future flags
OptionalprerenderAn array of URLs to prerender to HTML files at build time. Can also be a function returning an array to dynamically generate URLs.
unstable_concurrency defaults to 1, which means "no concurrency" - fully serial execution.
Setting it to a value more than 1 enables concurrent prerendering.
Setting it to a value higher than one can increase the speed of the build,
but may consume more resources, and send more concurrent requests to the
server/CMS.
OptionalpresetsAn array of React Router plugin config presets to ease integration with other platforms and tools.
OptionalrouteControl the "Lazy Route Discovery" behavior
routeDiscovery.mode: By default, this resolves to lazy which will
lazily discover routes as the user navigates around your application.
You can set this to initial to opt-out of this behavior and load all
routes with the initial HTML document load.routeDiscovery.manifestPath: The path to serve the manifest file from.
Only applies to mode: "lazy" and defaults to /__manifest.OptionalserverThe file name of the server build output. This file
should end in a .js extension and should be deployed to your server.
Defaults to "index.js".
OptionalserverA function for assigning routes to different server bundles. This function should return a server bundle ID which will be used as the bundle's directory name within the server build directory.
OptionalserverThe output format of the server build. Defaults to "esm".
OptionalssrEnable server-side rendering for your application. Disable to use "SPA
Mode", which will request the / path at build-time and save it as an
index.html file with your assets so your application can be deployed as a
SPA without server-rendering. Default's to true.
Config to be exported via the default export from
react-router.config.ts.