2

I am facing issue with ionic and scala . From https://www.playframework.com/documentation/2.5.x/CorsFilter I checked that cors filter we use

play.filters.cors {
  pathPrefixes = ["/some/path", ...]
  allowedOrigins = ["http://www.example.com", ...]
  allowedHttpMethods = ["GET", "POST"]
  allowedHttpHeaders = ["Accept"]
  preflightMaxAge = 3 days
}

When I am using following configuration

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
}   

Then it is working on WEB not in Ionic APP but when I am using following configuration

cors {
    pathPrefixes = ["/api"]
    allowedOrigins = null
    allowedHttpMethods = null
    allowedHttpHeaders = null
}

Then it is working on APP not in web .. What to do to resolve issue. I don't know is this configuration issue or my ionic code issue.

From this http://blog.ionic.io/handling-cors-issues-in-ionic/ , I tried to work with {

  "name": "proxy-example",
  "app_id": "",
  "proxies": [
    {
      "path": "/api",
      "proxyUrl": "http://cors.api.com/api"
    }
  ]
}

but it didn't work . Any help

Anuj
  • 151
  • 2
  • 11
  • are you testing this on localhost or? – Sampath Apr 14 '17 at 08:55
  • testing it from server api and testing it on local too, – Anuj Apr 14 '17 at 09:03
  • Have you used this plugin: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en – Sampath Apr 14 '17 at 09:16
  • this plugin is for chrome browser but my main concern is to use that api in both ionic and other language code where we use it , This issue can't be solve with this plugin – Anuj Apr 14 '17 at 09:30

0 Answers0