URL rewrite issue in angular and webpack

91 views Asked by At

My url is as follows:-

I want to make my linkname (that is a dynamic name, could be anything) for example:

abc.com/dinesh abc.com/anyname

It works well for all the cases except

If user pass anyname suffixed by /. ex:

abc.com/anyname/

It fails and goes back to abc.com. My code is as follows:

Angular v1 state provider code is as follows:

.state('otherwise', {
  url: '/:link',
  middleware: ['routerMiddleware']
});

I am using webpack version 1. The code is as follows:

 devServer: {
    proxy: {
      '!/**/*.*/': {
        target: 'http://localhost:8082/',
        pathRewrite: {
          '^/.*': ''
        }
      }
    }
  },
1

There are 1 answers

1
Dinesh Rawat On BEST ANSWER

It works fine for me:-

.state('otherwise', {
  url: '*link',
  middleware: ['routerMiddleware']
});