Skip to content

Commit

Permalink
fix: add nginx config to prevent 404 on page refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Niels Kersic authored and riccox committed May 8, 2024
1 parent 8dd217f commit ae8b497
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ RUN npm run build
FROM nginx

COPY --from=build /opt/meilisearch-ui/dist /usr/share/nginx/html

RUN sed -i 's/80/24900/g' /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 24900
28 changes: 28 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
events { }
http {

include mime.types;
sendfile on;

server {
listen 24900;
listen [::]:24900;
server_name localhost;

#error_page 404 /404.html;
root /usr/share/nginx/html;

# direct all traffic to index.html for client-side SPA routing
location / {
try_files $uri $uri/ /index.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 ae8b497

Please sign in to comment.