iview-cli 在webpack.dev.config.js 里的devServer配置代理跨域不生效
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 721
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
```
devServer:{
historyApiFallback: true,
hot: true,
inline: true,
proxy:{
'/api': {
target: 'http://example.com:8080',
secure: false,
changeOrigin: true,
pathRewrite:{
'^/api':'/api'
}
}
}
}
```
如此配置之后依然无法转发和跨域,参考了goole到的几篇文章,似乎都是这样配的。
参考地址1:https://segmentfault.com/q/1010000011222653
参考地址2:https://hk.saowen.com/a/1bfaaf0ee2020d8736982c9214aeffb83e1fac39b84eacac46388775de49cb38
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with webpack.dev.config.js and inspect the shown devServer.proxy configuration, then compare it with the referenced proxy guidance. Reproduce a request under /api and determine why it is not forwarded to http://example.com:8080. Done means the configured API request is proxied successfully without the reported cross-origin failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, webpack
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100