【发布时间】:2018-05-26 10:09:17
【问题描述】:
使用以下代码测试 CORS (spring boot 1.7):
registry.addMapping("/**").allowedOrigins("http://example.com", "http://example.org");
如果我尝试使用http://example.com 之类的原始标头,它可以完美运行,当我使用指示端口(@987654324@)、应用程序上下文(http://example.com/myApp)或路径(http://example.com/theSuperApp/get/catalogs)的 url 时,问题就来了,在任何其他情况下,它返回错误的不是确切的原始字符串,知道如何允许像下面这样的任何网址吗?:
https://example.org/
http://example.org:9080
http://example.org/aModule
http://example.org/aModule/submodule/subSubModule
http://example.org:80765/aModule/submodule/subSubModule
不用说我不想提供所有可能的 url 路径,因为随着时间的推移会添加新的路径
【问题讨论】:
标签: spring-boot cors cross-domain