Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.1k views
in Technique[技术] by (71.8m points)

webpack如何proxy绝对地址的api

proxy: {
  ’https://www.api.com/api111‘: {
     ’怎么代理这种啊?大佬们‘
  }
}

因为这个项目运行时,
不是https://www.api.com/域名的,
所以不能写成/api111的形式

怎么处理这种的跨域呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

webpack再怎么配置也只是用于本地开发请求代理,你部署到线上环境要解决跨域问题只能靠服务端配合解决,比如配置nginx代理,单独前端自己解决不了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...