Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
fix(ui): ensure that UI nginx routes to index.html as fallback (#824)
Browse files Browse the repository at this point in the history
As we're using virtual page routing in our UI, URLs which are unknown to
nginx should redirect to the index.html so that they can be resolved by
the React router.
  • Loading branch information
Tehsmash authored Oct 18, 2023
1 parent 97a50df commit 272dbba
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile.ui
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ RUN npm run build

FROM nginx:1.25.2

COPY --from=site-build ["/app/ui-build/nginx.conf", "/etc/nginx/conf.d/default.conf"]

COPY --from=site-build ["/app/ui-build/build", "/usr/share/nginx/html"]
22 changes: 22 additions & 0 deletions ui/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
listen 80;
listen [::]:80;
server_name localhost;

#access_log /var/log/nginx/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

0 comments on commit 272dbba

Please sign in to comment.