alibaba / lowcode-engine

An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系
https://lowcode-engine.cn
MIT License
14.66k stars 2.55k forks source link

开发新组建时如何配置代理 #1556

Closed goyidao closed 1 year ago

goyidao commented 1 year ago

我正在开发一个新组件: demo,按照文档,我的目录结构如图1。我想在该组件中请求本地的一个服务 http://localhost:8080/addData,遇到错误Access to XMLHttpRequest at 'http://localhost:8080/addData' from origin 'http://172.18.218.120:3333' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

我该如何添加配置文件解决这个问题?

guohejun commented 1 year ago

参考这个:https://github.com/alibaba/lowcode-engine/issues/1129

eternalsky commented 1 year ago

既然是 addData 失败,那你应该解决的是 addData 的跨域限制,详细去看 mdn 的 cors 介绍。https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CORS