Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

前端展示报错,找不到文章 #20

Open
brucewu10 opened this issue Nov 1, 2023 · 0 comments
Open

前端展示报错,找不到文章 #20

brucewu10 opened this issue Nov 1, 2023 · 0 comments

Comments

@brucewu10
Copy link

我按照楼主的步骤,在本地启动 后端及 前端

  1. 本机部署及启动后端工程,浏览器访问 http://localhost:8080/tumo 成功;

  2. 本机部署前端,http://localhost:9528/ 可以打开,但是访问 文章列表失败;
    经过排查,发现问题是跨域访问导致,在vue.config.js 的跨域配置少了部分内容:

    proxy: {
    '/api': {
    target: 'http://localhost:8080/',
    ws: true,

     //少了下面部分,导致加了/api 后,无法找到对应的后台接口
     changeOrigin: true,
     pathRewrite: {
      // ^代表字符串开头,实际发送请求时,会把请求开头的/demo删除
      // 因为/demo并不是请求的一部分,只是个代理的标识
         "^/api": ""
     }
    

    }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant