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

amis-editor-edmo 在编辑器中配置初始化接口 预览的时候 会报跨域 请问怎么通过配置解决 #10162

Closed
Xinxinz-l opened this issue May 6, 2024 · 4 comments
Assignees

Comments

@Xinxinz-l
Copy link

文档上是这样解释的 不是太明白 具体需要怎么配置呢

schemaFilter?: (schema: any, isPreview?: boolean) => any 配置过滤器。可以用来实现 api proxy,比如原始配置中请求地址是 http://baidu.com 如果直接给编辑器预览请求,很可能会报跨域,可以自动转成 /api/proxy?_url=xxxx,走 proxy 解决。
image

@allenve allenve self-assigned this May 8, 2024
@allenve
Copy link
Collaborator

allenve commented May 8, 2024

schemaFilter 用于替换 schema的内容,这里的思路是把api替换到自己的服务上,通过后端服务去转发请求实际的接口从而解决跨域。

@allenve allenve closed this as completed May 14, 2024
@Xinxinz-l
Copy link
Author

请问线上后端已经解决了跨域 在编辑器中还会报跨域吗

@Xinxinz-l
Copy link
Author

现在有一个问题 后端已经配置了跨域 同样的接口 在编辑器中或者是通过配置生成的页面 会报跨域 是什么问题呢

@allenve
Copy link
Collaborator

allenve commented May 23, 2024

host、端口不一致都会导致跨域 跨域问题和 amis 无关哈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants