IgMiddlewareHandler
export interface IgMiddlewareConfig {
settings: IgMiddlewareConfigSettings;
routes: {
forceSkipRoutes?: string[];
getServerSidePropsRoutes?: string[];
getStaticPropsRoutes?: string[];
};
}
export interface IgMiddlewareConfigSettings {
enabled: boolean;
orgId: string;
cacheIntervalMinutes?: number;
}
class IgMiddlewareHandler(req: NextRequest, igConfig: IgMiddlewareConfig){
setContext(res: NextResponse): Promise<NextResponse | undefined>;
}
Routes specified in routes
follow the same pattern as the Next.js matcher.
MUST start with
/
Can include named parameters:
/about/:path
matches/about/a
and/about/b
but not/about/a/c
Can have modifiers on named parameters (starting with
:
):/about/:path*
matches/about/a/b/c
because*
is zero or more.?
is zero or one and+
one or moreCan use regular expression enclosed in parenthesis:
/about/(.*)
is the same as/about/:path*
Read more details on path-to-regexp documentation.