From b2b04d7f2a273df15c25c8d80afff1ea200a0205 Mon Sep 17 00:00:00 2001 From: Chirag Chhatrala <60499540+chiragchhatrala@users.noreply.github.com> Date: Tue, 20 May 2025 18:21:44 +0530 Subject: [PATCH] Self hosted domain redirect (#756) * Integration pages from Notion * Self hosted domain redirect * Refactor root-redirect middleware and update 404 page layout - Simplified the `root-redirect.js` middleware by removing the specific route checks, allowing for a more general redirect based on the `self_hosted` feature flag. - Updated the 404 error page in `[...all].vue` by removing the unnecessary `NuxtLayout` wrapper and replacing `NuxtLink` with a custom `UButton` for navigation, enhancing the overall layout and user experience. These changes aim to streamline the redirect logic and improve the presentation of the 404 error page. * Refactor feature flag handling and update middleware - Updated the condition in `Navbar.vue` to correctly evaluate the feature flags for rendering the AI form builder link. - Removed the `feature-flags.global.js` middleware as it was no longer needed, streamlining the middleware structure. - Enhanced the `root-redirect.js` middleware to utilize `h3`'s `sendRedirect` for server-side redirection, improving the redirect logic. - Modified the `ai-form-builder.vue` page to include the new `root-redirect` middleware, ensuring proper redirection based on feature flags. These changes aim to improve the handling of feature flags and redirection logic, enhancing the overall application flow. --------- Co-authored-by: Julien Nahum --- client/.env.example | 3 +- client/components/global/Navbar.vue | 2 +- client/middleware/root-redirect.js | 21 +++++++ client/pages/[...all].vue | 39 +++++++++++++ client/pages/ai-form-builder.vue | 2 +- client/pages/index.vue | 3 + client/pages/integrations/[slug].vue | 2 +- client/pages/integrations/index.vue | 2 +- .../feature-flags.js} | 4 +- client/runtimeConfig.js | 2 +- docs/configuration/environment-variables.mdx | 55 ++++++++++--------- 11 files changed, 100 insertions(+), 35 deletions(-) create mode 100644 client/middleware/root-redirect.js create mode 100644 client/pages/[...all].vue rename client/{middleware/feature-flags.global.js => plugins/feature-flags.js} (81%) diff --git a/client/.env.example b/client/.env.example index e38c36bf..30d9dc1d 100644 --- a/client/.env.example +++ b/client/.env.example @@ -7,4 +7,5 @@ NUXT_PUBLIC_ENV= NUXT_PUBLIC_GOOGLE_ANALYTICS_CODE= NUXT_PUBLIC_H_CAPTCHA_SITE_KEY= NUXT_PUBLIC_RE_CAPTCHA_SITE_KEY= -NUXT_API_SECRET=secret \ No newline at end of file +NUXT_API_SECRET=secret +NUXT_PUBLIC_ROOT_REDIRECT_URL= \ No newline at end of file diff --git a/client/components/global/Navbar.vue b/client/components/global/Navbar.vue index 14dca958..1a5082c1 100644 --- a/client/components/global/Navbar.vue +++ b/client/components/global/Navbar.vue @@ -53,7 +53,7 @@