Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

throw 405 for POST endpoints that don't exist

Blue Mouse40602535a53c
diff --git a/web/app/root.tsx b/web/app/root.tsx
index 9be8cf677..89a0334c5 100644
--- a/web/app/root.tsx
+++ b/web/app/root.tsx
@@ -6,6 +6,7 @@ import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import type { LinksFunction, LoaderFunctionArgs, HeadersFunction } from 'react-router'
import {
+ data,
redirect,
Links,
Meta,
@@ -74,6 +75,12 @@ export const headers: HeadersFunction = () => ({
Expires: '0',
})
+// Fix for "You made a POST request to ... but did not provide an `action`" error
+// caused by bots probing endpoints that don't support POST requests.
+export async function action() {
+ return data(null, { status: 405, statusText: 'Method Not Allowed - non existent endpoint' })
+}
+
export function ErrorBoundary() {
const error = useRouteError()
const [crashStackShown, setCrashStackShown] = useState(false)