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

Categories

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

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

怎么处理这种的跨域呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...