Hi @SamO, thanks for your help, I’m still waiting to be contacted, but meanwhile I think I’ve managed to fix our requests problems.
I activated Netlify Analytics, and in it I found something interesting which you can see below, which is that we have thousands of requests to php files which we don’t have.
This is clearly what is causing all the 404 errors and is probably caused by some spam bots. Since blocking these requests is not trivial, what I did was use an edge function that runs for every *.php request that quickly returns a very small 404 page instead of the normal one, saving bandwidth and preventing the request from hitting our Next function.
It’s still early to say whether it fixed everything, but it definitely the invocations to the Next function, as you can see from the drop in 404 invocation in the image below (arrow marks the time when I deployed the solution).
@jfrank14 I’m not sure if your problem is the same, but you can either pay for Netlify Analytics to find out, or test our solution to see if it solves it for you, it should be safe as long as you don’t have legitimate *.php files in your project.
The solution is simply to install @netlify/edge-functions, and add this file to the netlify/edge-functions folder.
import type { Config } from '@netlify/edge-functions'
export default async function () {
const html404 =
'<!DOCTYPE html><html><head><title>404 Not Found</title></head><body><h1>404 Not Found</h1></body></html>'
return new Response(html404, {
status: 404,
headers: {
'Content-Type': 'text/html',
'netlify-cdn-cache-control':
'durable, immutable, max-age=31536000, public',
},
})
}
export const config: Config = {
cache: 'manual',
pattern: '^.*\\.[Pp][Hh][Pp]$',
}

