明显的 CORS 错误隐藏了我们找不到的其他错误,正在寻找想法

问题描述 投票:0回答:0

我们在调试一个看起来像 CORS 问题的问题时遇到了麻烦,但最终不是。 我们的应用程序会随机遇到请求未完成的错误。当我们重试相同的请求时,效果很好。

有时我们使用通配符配置 CORS,但仍然遇到同样的问题。

该问题在本地无法重现,并且在生产中随机发生。

我们在 datadog 上有 401 日志,但在我们的 heroku 服务器上没有日志。

似乎当我们刚启动应用程序时,错误发生得更频繁。

我们的服务器使用 php symfony4 和 nelmio cors 捆绑包

nelmio_cors:
    defaults:
        origin_regex: true
        allow_origin: ['^.*\.site.com', '^https?://localhost(:[0-9]+)?$']
        allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
        allow_headers: ['Content-Type', 'Authorization', 'language', 'include']
        max_age: 3600
    paths:
        '^/': null

此时,我们正在寻找可以研究的想法,因为我们不知道该去哪里寻找。

任何帮助表示赞赏,谢谢:)

debugging heroku cors symfony4 http-status-code-401
© www.soinside.com 2019 - 2024. All rights reserved.