Skip to content
Snippets Groups Projects
Verified Commit b5617f46 authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Enable nginx to forward all unknown routes to Vue

#4
parent e36a553a
No related branches found
No related tags found
2 merge requests!22Version 1.0.0,!2Forward unknown routes to Vue
Pipeline #24657 passed
...@@ -18,7 +18,7 @@ coverage ...@@ -18,7 +18,7 @@ coverage
/cypress/screenshots/ /cypress/screenshots/
# Editor directories and files # Editor directories and files
ProxyAPI-UI/.vscode/extensions.json .vscode/extensions.json
!.vscode/extensions.json !.vscode/extensions.json
.idea .idea
*.suo *.suo
...@@ -26,3 +26,4 @@ ProxyAPI-UI/.vscode/extensions.json ...@@ -26,3 +26,4 @@ ProxyAPI-UI/.vscode/extensions.json
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
.env
...@@ -11,5 +11,6 @@ RUN npm run build-only ...@@ -11,5 +11,6 @@ RUN npm run build-only
# production stage # production stage
FROM nginx:stable-alpine as production-stage FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
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;
}
}
...@@ -34,5 +34,4 @@ ...@@ -34,5 +34,4 @@
</div> </div>
</template> </template>
<style scoped> <style scoped></style>
</style>
...@@ -35,6 +35,10 @@ const router = createRouter({ ...@@ -35,6 +35,10 @@ const router = createRouter({
path: "/", path: "/",
redirect: { name: "buckets" }, redirect: { name: "buckets" },
}, },
{
path: "/:pathMatch(.*)",
component: () => import("../views/NotFoundView.vue"),
},
], ],
}); });
......
<script setup lang="ts"></script>
<template>
<div
class="container p-3 top-50 left-50 translate-middle position-fixed text-center"
>
<span class="fs-1 mb-5">Page Not Found</span><br />
<span class="fs-3"
>Back to the <router-link to="/">HomePage</router-link></span
>
</div>
</template>
<style scoped></style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment