错误 Angularjs + Lagom 框架

ERROR Angularjs + Lagom Framework

选项http://localhost:9000/api/chat/ 404(未找到) XMLHttpRequest 无法加载 http://localhost:9000/api/chat/。预检响应具有无效的 HTTP 状态代码 404

https://www.playframework.com/documentation/2.5.x/CorsFilter 详细介绍了为 Play 启用 CORS(Lagom 的构建基础)。要处理 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>