选项http://localhost:9000/api/chat/ 404(未找到)XMLHttpRequest无法加载http://localhost:9000/api/chat/ . 预检的响应具有无效的HTTP状态代码404
https://www.playframework.com/documentation/2.5.x/CorsFilter有关于启用CORS for Play的详细信息(这是基于Lagom的) . 要处理 OPTIONS ,您可能需要执行以下操作:
OPTIONS
.withAutoAcl(true) .withServiceAcls( ServiceAcl.methodAndPath(Method.OPTIONS, "/foo") )
https://groups.google.com/forum/#!msg/lagom-framework/dtYN_1Ds4SQ/gT-BGPuCAQAJ是一个带有更多细节的lagom-framework列表讨论主题 .
https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Preflighted_requests解释了您的浏览器为何开始发送 OPTIONS 请求 .
metadata for the current exact maven artifact which provides CORS for Play是这样的:
<metadata> <groupId>com.typesafe.play</groupId> <artifactId>filters-helpers_2.12</artifactId> <versioning> <latest>2.6.0-M2</latest> <release>2.6.0-M2</release> <versions> <version>2.6.0-M1</version> <version>2.6.0-M2</version> </versions> <lastUpdated>20170310220437</lastUpdated> </versioning> </metadata>
1 回答
https://www.playframework.com/documentation/2.5.x/CorsFilter有关于启用CORS for Play的详细信息(这是基于Lagom的) . 要处理
OPTIONS
,您可能需要执行以下操作:https://groups.google.com/forum/#!msg/lagom-framework/dtYN_1Ds4SQ/gT-BGPuCAQAJ是一个带有更多细节的lagom-framework列表讨论主题 .
https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Preflighted_requests解释了您的浏览器为何开始发送
OPTIONS
请求 .metadata for the current exact maven artifact which provides CORS for Play是这样的: