-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
What problem does this feature solve?
The following url:
http://www.exemple.com/agency/
is NOT the same as the following url:
http://www.exemple.com/agency
for SEO crawler and HTTP point of vue.
This is not a big deal for a SPA without SEO requirement but in an SSR app this is critical.
If I use, for example, Express.js to serve my application with the strict mode and following routes :
app.set("strict routing", true);
app.get('/agency/', agencyPage);
app.get('/*', errorPage);The pages (based on Vue renderer) HTTP served for following URL will be :
http://www.exemple.com/agency/==> agencyhttp://www.exemple.com/agency==> errorhttp://www.exemple.com/foo==> error
But, when client-side Vue will perform hydratation, the component/route will be resolved as following
http://www.exemple.com/agency/==> agency : Goodhttp://www.exemple.com/agency==> agency : Failhttp://www.exemple.com/foo==> error : Good
For http://www.exemple.com/agency, hydratation fail because the source code come currently from errorPage process (/agency/ is not the same page as /agency and HTTP returned a 404 error code) but client-side Vue Router find a route /agency for /agency/.
There is maybe a way to explain to router how the route should be match ?
What does the proposed API look like?
declare type RouteConfig = {
...
strict?: boolean
...
}Allows Vue Router to work in the same way as usual but allows to corretly recognise HTTP different url for SEO/SSR mode with 'strict mode'.