Web pack agent solving cross domain


Open a 9000 port and another 8881 port. On the 9000 port access page, the data interface is 8881, which leads to cross domain. How to solve this problem?

The configuration in webpack is as follows:

proxy: {
            '/api/*': {
                target: 'http://localhost:8880'

In this way, the data can be accessed through port 8881 and port 9000