From e20ca4654f36be99090e869b353bd64345ed1b39 Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 2 Mar 2025 11:17:26 +0100 Subject: [PATCH] cleanup netlify.toml + add logging --- frontend/netlify.toml | 9 +++------ frontend/src/helpers/checkAndSetApiUrl.ts | 4 +++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/netlify.toml b/frontend/netlify.toml index 43e13edc6..d48bb5f26 100644 --- a/frontend/netlify.toml +++ b/frontend/netlify.toml @@ -7,18 +7,15 @@ to = "https://try.vikunja.io/api/:splat" status = 200 force = true - headers = {X-Debug-Redirect = "api-rule"} [[redirects]] from = "/*" to = "/index.html" status = 200 - headers = {X-Debug-Redirect = "all-to-index"} [[headers]] for = "/*" [headers.values] - X-Frame-Options = "DENY" - X-XSS-Protection = "1; mode=block" - X-Robots-Tag = "noindex" - X-Debug = "global-debug" + X-Frame-Options = "DENY" + X-XSS-Protection = "1; mode=block" + X-Robots-Tag = "noindex" diff --git a/frontend/src/helpers/checkAndSetApiUrl.ts b/frontend/src/helpers/checkAndSetApiUrl.ts index 3ac1770c8..b60886b50 100644 --- a/frontend/src/helpers/checkAndSetApiUrl.ts +++ b/frontend/src/helpers/checkAndSetApiUrl.ts @@ -20,7 +20,8 @@ export class InvalidApiUrlProvidedError extends Error { } } -export const checkAndSetApiUrl = (url: string | undefined | null): Promise => { +export const checkAndSetApiUrl = (pUrl: string | undefined | null): Promise => { + let url = pUrl if (url === '' || url === null || typeof url === 'undefined') { throw new NoApiUrlProvidedError() } @@ -55,6 +56,7 @@ export const checkAndSetApiUrl = (url: string | undefined | null): Promise { + console.warn(`Could not fetch 'info' from the provided endpoint ${pUrl} on ${window.API_URL}/info. Some automatic fallback will be tried.`) // Check if it is reachable at /api/v1 and http if ( !urlToCheck.pathname.endsWith('/api/v1') &&