我面临着离子和斯卡拉的问题。从https://www.playframework.com/documentation/2.5.x/CorsFilter我检查了我们使用的cors过滤器
play.filters.cors {
pathPrefixes = ["/some/path", ...]
allowedOrigins = ["http://www.example.com", ...]
allowedHttpMethods = ["GET", "POST"]
allowedHttpHeaders = ["Accept"]
preflightMaxAge = 3 days
}
当我使用以下配置时
cors {
# The path prefixes to filter.
pathPrefixes = ["/"]
# The allowed origins. If null, all origins are allowed.
allowedOrigins = null
# The allowed HTTP methods. If null, all methods are allowed
allowedHttpMethods = null
# The allowed HTTP headers. If null, all headers are allowed.
allowedHttpHeaders = null
}
然后它正在 WEB而不是Ionic APP ,但当我使用以下配置时
cors {
pathPrefixes = ["/api"]
allowedOrigins = null
allowedHttpMethods = null
allowedHttpHeaders = null
}
然后它正在开发 APP不在网络 .. 如何解决问题。我不知道这个配置问题或我的离子代码问题。
从http://blog.ionic.io/handling-cors-issues-in-ionic/开始,我尝试使用{
"name": "proxy-example",
"app_id": "",
"proxies": [
{
"path": "/api",
"proxyUrl": "http://cors.api.com/api"
}
]
}
但它没有用。任何帮助