Vue-router: Dot (.) in URL

Created on 25 Jul 2016  ·  3Comments  ·  Source: vuejs/vue-router

I've used Vue Router; I was trying to use a domain name in the path, and I've got a problem.

When I use dot (.) for example http://mywebsite.com/domains/xyz.com in the path, Vue could not find the path and did not go to the component.

Most helpful comment

@ChristianSiegert I wrote a rewrite in dev-server.js

// handle fallback for HTML5 history API
// app.use(require('connect-history-api-fallback')())
var historyApiFallback = require('connect-history-api-fallback')({
    // disableDotRule: true,
    // verbose: true,
    rewrites: [
        {
            from: /^\/cdn\/.*$/,
            to: '/'
        }
    ]
})

folder is an initial path for my app.

All 3 comments

I've checked twice. The problem was for middleware of the webpack. The routing is fine and it depends on your web server.

@saman How did you solve this? I have the same issue (dot in URL path). When I click on a \ I can access the URL, but when I refresh the page in the browser, I get a “Cannot GET /foo.bar” message. So the internal routing with vue-router works but a direct access does not.

Edit: I’m running in dev mode (npm run dev).

@ChristianSiegert I wrote a rewrite in dev-server.js

// handle fallback for HTML5 history API
// app.use(require('connect-history-api-fallback')())
var historyApiFallback = require('connect-history-api-fallback')({
    // disableDotRule: true,
    // verbose: true,
    rewrites: [
        {
            from: /^\/cdn\/.*$/,
            to: '/'
        }
    ]
})

folder is an initial path for my app.

Was this page helpful?
0 / 5 - 0 ratings