From a12b6c4bdaa79d8f6d245fd4d38d5ca1d53d7a2a Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Thu, 10 Aug 2023 21:17:40 +0200 Subject: [PATCH] Force 404 on static folder when a file is not found (#1165) --- infra/prod/front/Dockerfile | 4 +++- infra/prod/front/serve.json | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 infra/prod/front/serve.json diff --git a/infra/prod/front/Dockerfile b/infra/prod/front/Dockerfile index d5f353d84..28b9ccc3b 100644 --- a/infra/prod/front/Dockerfile +++ b/infra/prod/front/Dockerfile @@ -13,6 +13,8 @@ COPY ./front . RUN yarn install RUN yarn build +COPY ./infra/prod/front/serve.json ./build + FROM node:18.16.0-alpine as front WORKDIR /app/front @@ -20,4 +22,4 @@ COPY --from=build /app/front/build ./build RUN yarn global add serve -CMD ["serve", "-s", "build"] +CMD ["serve", "build"] diff --git a/infra/prod/front/serve.json b/infra/prod/front/serve.json new file mode 100644 index 000000000..cd8879807 --- /dev/null +++ b/infra/prod/front/serve.json @@ -0,0 +1,6 @@ +{ + "rewrites": [ + { "source": "!static/**", "destination": "/index.html" } + ], + "directoryListing": false +} \ No newline at end of file