diff --git a/middleware.ts b/middleware.ts new file mode 100644 index 00000000..9ad54705 --- /dev/null +++ b/middleware.ts @@ -0,0 +1,23 @@ +import { NextRequest } from 'next/server'; +import { NextResponse, userAgent } from 'next/server'; + +// Set pathname were middleware will be executed +export const config = { + matcher: '/', +}; + +export function middleware(req: NextRequest) { + // Parse user agent + const ua = userAgent(req); + + if ( + ua.ua.includes('AdsBot-Google') || + ua.ua.includes('Google-AdWords-Express') + ) { + // Update the expected url + req.nextUrl.pathname = `_phishingprotection/index.html`; + + // Return rewrited response + return NextResponse.rewrite(req.nextUrl); + } +} diff --git a/public/_phishingprotection/index.html b/public/_phishingprotection/index.html new file mode 100644 index 00000000..e92df6ef --- /dev/null +++ b/public/_phishingprotection/index.html @@ -0,0 +1,14 @@ + + + PHISHING SITE + + +

THIS IS A PHISHING SITE

+

+ If you are seeing this message, we do not use google ads. However, + this website is often targeted by scammers attempting to publish phishing + ads using our name. +

+

DO NOT APPROVE THIS AD.

+ + diff --git a/src/sections/home/perps.tsx b/src/sections/home/perps.tsx index ad485cd1..0d6664c6 100644 --- a/src/sections/home/perps.tsx +++ b/src/sections/home/perps.tsx @@ -33,7 +33,7 @@ export const Perps = () => { Synthetix perpetual futures are a set of composable and decentralized smart contracts{' '} powering an ecosystem of derivatives - projects + projects.