---
title: "vueCli3 项目 跨域 前端vue.config.js配置反向代理"
id: "3209"
type: "post"
slug: "vuecli3-%e9%a1%b9%e7%9b%ae-%e8%b7%a8%e5%9f%9f-%e5%89%8d%e7%ab%afvue-config-js%e9%85%8d%e7%bd%ae%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86"
published_at: "2021-01-13T00:50:46+00:00"
modified_at: "2021-01-13T00:50:46+00:00"
url: "https://seq.ink/all/3209.html"
markdown_url: "https://seq.ink/all/3209.html.md"
excerpt: "module.exports = { devServer: { open: true, proxy: { '/api': { // 接口请求路径 target: `http://xxxx.xxxx.com/`, chan ..."
taxonomy_category:
  - "ALL"
  - "Coding代码堆"
---

```
module.exports = {
  devServer: {
    open: true,
    proxy: {
      '/api': {
      //  接口请求路径
        target: `http://xxxx.xxxx.com/`,
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }
    }
  }
}
```
