Vue-router does not catch routes with a dot

I bootstrapped my application from the webpack template and added the route /edit/:filename to it.

The problem is, filenames containing a dot are not handled by my Vue application.

In other words, /edit/123 is matched by the route but /edit/123.json or /edit/123.txt is not and I get a 404 from Express. A console.log inside webpack-dev-middleware request handler shows the request to /edit/123.json instead of a request to /app.js.

How can I match anything or at least /edit/anyfilename.json in my route?

You would have to change this line to this:

app.use(require('connect-history-api-fallback')({
  disableDotRule: true
}))

For reference: https://github.com/bripkens/connect-history-api-fallback#disabledotrule

1 Like

Wow! Thanks a lot! This was not obvious at all.

where do i add this line? if iā€™m using nuxt js