From 89aa048fc1caf1741f1063e8c86b7f19a9006cc2 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Fri, 19 Apr 2024 13:29:18 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(app-desk)=20force=20redirect=20on?= =?UTF-8?q?=20resources/[id]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we use the static mode, Next.js want that we build our resource pages at build time. But we can't do that because users can create a resource at runtime. So we redirect thanks to ngnix when we see that a resource page is not found. --- src/frontend/apps/impress/conf/default.conf | 8 ++++++++ src/frontend/apps/impress/next.config.js | 1 + src/frontend/apps/impress/src/features/menu/Menu.tsx | 8 ++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/frontend/apps/impress/conf/default.conf b/src/frontend/apps/impress/conf/default.conf index fe8f1cb9..d2b9fba2 100644 --- a/src/frontend/apps/impress/conf/default.conf +++ b/src/frontend/apps/impress/conf/default.conf @@ -8,6 +8,14 @@ server { try_files $uri index.html $uri/ =404; } + location /pads/ { + error_page 404 /pads/[id]/; + } + + location /templates/ { + error_page 404 /templates/[id]/; + } + error_page 404 /404.html; location = /404.html { internal; diff --git a/src/frontend/apps/impress/next.config.js b/src/frontend/apps/impress/next.config.js index d8ac8ba8..e2eb64f4 100644 --- a/src/frontend/apps/impress/next.config.js +++ b/src/frontend/apps/impress/next.config.js @@ -1,6 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { output: 'export', + trailingSlash: true, images: { unoptimized: true, }, diff --git a/src/frontend/apps/impress/src/features/menu/Menu.tsx b/src/frontend/apps/impress/src/features/menu/Menu.tsx index 365d7755..ffa42004 100644 --- a/src/frontend/apps/impress/src/features/menu/Menu.tsx +++ b/src/frontend/apps/impress/src/features/menu/Menu.tsx @@ -21,8 +21,12 @@ export const Menu = () => { $justify="space-between" > - - + + );