Skip to main content

@sveltejs/kit/adapter

import { function applyReroute(response: Response, next: (url: URL) => Response | Promise<Response>): Response | Promise<Response>

Helps a catch-all request handler pass the request to a different handler if the reroute hook has returned a URL pathname that’s different from the incoming request.

If your adapter is capable of deploying multiple serverless functions, it’s a good idea to also deploy a “catch-all” one to handle uncaught requests. Running this in that function allows the app’s reroute hook to rewrite the request URL and invoke the next appropriate serverless function, if any.

@param
response The response returned from the SvelteKit server.respond function
@param
next Your platform-specific implementation for invoking the next handler with a different request URL
@since
3.0.0
applyReroute
} from '@sveltejs/kit/adapter';

applyReroute

Available since 3.0.0

Helps a catch-all request handler pass the request to a different handler if the reroute hook has returned a URL pathname that’s different from the incoming request.

If your adapter is capable of deploying multiple serverless functions, it’s a good idea to also deploy a “catch-all” one to handle uncaught requests. Running this in that function allows the app’s reroute hook to rewrite the request URL and invoke the next appropriate serverless function, if any.

function applyReroute(
	response: Response,
	next: (url: URL) => Response | Promise<Response>
): Response | Promise<Response>;

Edit this page on GitHub llms.txt