【问题标题】:CORS with dynamic origin具有动态起源的 CORS
【发布时间】:2014-12-31 06:03:11
【问题描述】:

我正在使用 CORS 来允许来自我的 Asp.Net Web Api 服务的跨源请求。当我使用 -

[EnableCors(origins: "*", headers: "*", methods: "*")]

我在打嗝报告中收到中等严重性错误。我有动力学起源 -

https://*.abc.com

。在这种情况下如何允许动态来源而不是使用“*”。

【问题讨论】:

    标签: cors asp.net-web-api2


    【解决方案1】:

    我已经用这种CORS 用正则表达式配置了我的apache2,希望它有助于解决你的问题。

    [EnableCors(origins: "((http(s?))?://(www\.)?(mydomain)\.com)(:\d+)?", headers: "*", methods: "*")]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-28
      • 2014-07-06
      • 2023-03-08
      • 2017-04-09
      • 1970-01-01
      • 2016-11-08
      • 1970-01-01
      • 2021-10-23
      相关资源
      最近更新 更多