parent
6b6043afdc
commit
9ff83075d6
|
@ -11,6 +11,12 @@ const middleware: NextMiddleware = async (req) => {
|
||||||
const url = req.nextUrl;
|
const url = req.nextUrl;
|
||||||
const requestHeaders = new Headers(req.headers);
|
const requestHeaders = new Headers(req.headers);
|
||||||
|
|
||||||
|
if (isIpInBanlist(req) && url.pathname !== "/api/nope") {
|
||||||
|
// DDOS Prevention: Immediately end request with no response - Avoids a redirect as well initiated by NextAuth on invalid callback
|
||||||
|
req.nextUrl.pathname = "/api/nope";
|
||||||
|
return NextResponse.redirect(req.nextUrl);
|
||||||
|
}
|
||||||
|
|
||||||
if (!url.pathname.startsWith("/api")) {
|
if (!url.pathname.startsWith("/api")) {
|
||||||
//
|
//
|
||||||
// NOTE: When tRPC hits an error a 500 is returned, when this is received
|
// NOTE: When tRPC hits an error a 500 is returned, when this is received
|
||||||
|
@ -79,6 +85,7 @@ const middleware: NextMiddleware = async (req) => {
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
matcher: [
|
matcher: [
|
||||||
|
"/:path*",
|
||||||
"/api/collect-events/:path*",
|
"/api/collect-events/:path*",
|
||||||
"/api/auth/:path*",
|
"/api/auth/:path*",
|
||||||
"/apps/routing_forms/:path*",
|
"/apps/routing_forms/:path*",
|
||||||
|
|
Loading…
Reference in New Issue