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

Failed to upload image when proxy #669

Closed
zhangfu-git opened this issue Apr 11, 2018 · 1 comment · Fixed by #786
Closed

Failed to upload image when proxy #669

zhangfu-git opened this issue Apr 11, 2018 · 1 comment · Fixed by #786

Comments

@zhangfu-git
Copy link

.roadhogrc.mock.js

Environment(required) | 环境(必填)

roadhog 2.3.0
node 8.10.0
Mac 10.13.4

What did you do? Please provide steps to re-produce your problem.(请提供复现步骤)

.roadhogrc.mock.js 配置

const noProxy = process.env.NO_PROXY === 'true';
export default noProxy ? {
  "POST /(.*)": "http://127.0.0.1:1337/",
  "PUT /(.*)": "http://127.0.0.1:1337",
  "GET /(.*)": "http://127.0.0.1:1337/",
  "DELETE /(.*)": "http://127.0.0.1:1337/"
} : delay(proxy, 1000);
npm run start:no-proxy

使用antd 的Upload组件上传图片

What do you expected?(预期的正常效果)

预期图片上传成功

What happen?(发生了何种非正常现象)

请求头正常,但服务端没有接收到上传的图片,打包后的代码不走代理上传图片成功。

@yuyueh
Copy link

yuyueh commented Apr 15, 2018

#482 可以參考這篇最下面的回答。
.roadhogrc.mock.js 裡設定307的轉發就可以讀取到檔案了。

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

Successfully merging a pull request may close this issue.

2 participants