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!

Clarify Swetrix CE backend proxy

Blue Mouse2bdb7fc5a1db
diff --git a/web/app/routes/backend.$.tsx b/web/app/routes/backend.$.tsx
new file mode 100644
index 000000000..eda14aeb3
--- /dev/null
+++ b/web/app/routes/backend.$.tsx
@@ -0,0 +1,18 @@
+import {
+ data,
+} from 'react-router'
+
+// This route is only used for Swetrix CE installations.
+// In theory, users should never hit this route because NGINX proxies all requests to the backend.
+// However, if it's misconfigured, or they do hit it for some reason, we should throw an error.
+
+const errorMessage =
+ 'Backend proxy is not configured. Ensure NGINX forwards /backend/* to the Swetrix API (swetrix-api) service.'
+
+export async function action() {
+ return data({ error: errorMessage }, { status: 418 })
+}
+
+export async function loader() {
+ return data({ error: errorMessage }, { status: 418 })
+}