Search.../

forbidden( )

Returns a response with a status code 403 (Forbidden) and instructs the router to show a 403 page.

Description

The forbidden() function is used in the router(), beforeRouter(), and afterRouter() hooks to indicate that the requested page is forbidden. Optionally, you can pass a message that otherwise defaults to 'Forbidden'.

Syntax

function forbidden([message: string]): Promise<WixRouterResponse>

forbidden Parameters

NAME
TYPE
DESCRIPTION
message
Optional
string

The message to show.

Returns

Fulfilled - A response object with HTTP status code 403.

Return Type:

Was this helpful?

Create a forbidden response

Copy Code
1import {forbidden} from 'wix-router';
2
3export function myRouter_Router(request) {
4
5 return forbidden();
6}