前端集成 sentry 跨域怎么办?
按照 sentry
文档,将代码集成到前端项目里:
import * as Sentry from '@sentry/react';
import { Integrations } from '@sentry/tracing';
Sentry.init({
dsn: 'http://xxxx@xxx:9000/2',
integrations: [new Integrations.BrowserTracing()],
tracesSampleRate: 1.0
});
但前端项目会报跨域:
我查了 sentry 文档和网上文章,几乎没找到靠谱的解决方案,这个应该怎么解决?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
既然跨域那么就是允许跨域咯。
'http://xxxx@xxx:9000/2'
这个服务端配置好。'http://xxxx@xxx:9000/2'
改成'/2'
,然后在自己服务端 nginx 配置proxy_pass 咯想请教下,问题最后是如何解决的呢
用whistle代理可以解决

比如: https://xxxx:9000 http://xxxx:9000
这时候再看请求,地址已经变成了whistle本地的地址,说明成功了
我的做法(docker安装的,自己的虚拟机vm 和 本地的前端项目)sentry v22.5.0(目前最新)版本 docker v20.10.16 docker-compose v2.6.0
1.删除所有sentry相关的容器,镜像
2.重新git下载源码,切换到想要的版本目录
3.重新./install.sh
4.重新docker-compose up -d
注。我还加个nginx去做反向代理,以下是nginx的配置
然后就成功了 状态码为200了

请问下这个最终怎么解决的呢?