Vue solve cross-domain problems: Forward Proxy and Reverse Proxy

 

You need to do a reverse proxy stuff ===> Open the config file to your project folder under vue index.js

 

Locate the following code  

dev: { 
        proxyTable: {
           '/ API' : { 
            target: 'HTTP: // ip address', // there is you want to access the IP address 
            changeOrigin: to true ,      // enable proxy 
            pathRewrite: {
               '^ / API' : '/ API' 
          } 

    }

Modified:

    dev: { 
            proxyTable: {
                 '/ Queue-ADMIN': {   // Use "/ queue-admin" instead of API head, can be named 
                  // target: '...', // address of the local source API developed head 
                  target: "...",   // configure the server to the rear end of the head API 
                  pathRewrite: {
                     '^ / Queue-ADMIN': '/ Queue-ADMIN'   // path rewritten, first the same as above, the second / queue-admin is server.context-path (context server) 
                  },
                   // following solutions https access problems. The above can be accessed HTTP 
                  changeOrigin: to true , 
                  Secure: false , 
                  headers: { 
                    Referer:'...'
                  }
                }
            }
         }

 

Tips: after completing this configuration must be restarted or else the project will have no effect

Guess you like

Origin www.cnblogs.com/it-Ren/p/11314706.html