Url error of axios request after vue packaging

before the package (localhost:8080), the request can succeed. After the package, the request has an url error and there is an extra api. Ask for advice.

Jun.24,2022

ider/p/7076191.html" rel=" nofollow noreferrer "> https://www.cnblogs.com/cools...
I wonder if this will help you


this agent can only be used in


wepack to set axios generation.


need to use nginx as a reverse proxy


it needs to be configured after deployment. If nginx is used to separate the front and rear of the deployment

http {
    include       mime.types;
    default_type  application/octet-stream;

    server {
        -sharp
        listen      5050 ;
        server_name  localhost;
        -sharp
        location / {
            -sharp
            root   /opt/demo;
            -sharp
            index  index.html;
        }
        -sharpproxy
        location /api {
            proxy_pass http://xx.xx.xx.xx:80;
        }        
    }
}
Menu