How to try fallback option if URL not found in vue router #1670
Unanswered
amustaque97
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version
4.1.6
Steps to reproduce
I'm building an app using vuejs Nginx and some backend technologies like ExpressJs. So in my use-case, I'm creating a standalone app for the frontend apps, and the backend with ExpressJs is independent.
For serving the routes I'm using Nginx for both front-end routes and for the backend routes.
Let's assume in frontend there are only two routes
Whereas on the backend side we got many routes like:
and so on.
When I configure routes in the Nginx to serve HTTP requests based on the routes. In Nginx terminology, it is called a location block.
when a request comes to the frontend i.e. vue.js router whether a URL is present or not it returns a response of index.html or 404 and it then doesn't check the backend routes.
For example: User A wants to hit /trigger endpoint since it is not present in the VueJS route so it should check in the backend routes and return the response if it valid or else 404 at the last.
My query is how to configure VueJs router to not return response if URL is not present.
What is expected?
I want to route the request to the other services/backend if VueJS doesn't have a valid route.
What is actually happening?
VueJS is directly returning a response before going to other services in the Nginx location block even if the route is not present in the VueJS frontend app.
Beta Was this translation helpful? Give feedback.
All reactions