CORS: XMLHttpRequest cannot load http://192.168.0.1:7307/login. Cross-origin redirection denied by Cross-Origin Resource Sharing policy.
Hello all,
I'm trying to workaround of this issue. Following CORS-Headers are set on the server side:
Access-Control-Allow-Origin: * Access-Control-Allow-Methods: * Access-Control-Max-Age: 1728000 Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
And it seems to be working. But on redirect:
HTTP/1.1 302 Found Server: Apache-Coyote/1.1 X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: 0 X-Frame-Options: DENY Set-Cookie: s=C5641CC2F661DA5C9FB04E396753D589; Expires=Sun, 30-Jul-2017 13:47:36 GMT; Path=/; HttpOnly Set-Cookie: XSRF-TOKEN=013680c5-bdde-4239-b8b7-189e1cda3fe6; Path=/ Location: http://192.168.0.1:7307/authorize?client_id=client&redirect_uri=http://192.168.0.1:7307/login&response_type=code&state=Iz25Ml Content-Length: 0 Date: Sat, 29 Jul 2017 13:47:36 GMT
it throws:
XMLHttpRequest cannot load http://192.168.0.1:7307/login. Cross-origin redirection denied by Cross-Origin Resource Sharing policy.
Is there any way to resolve or workaround this? I use Ionic v1.
Hi @Bessonov. You can try this https://github.com/sneas/ionic-native-http-connection-backend. It solves CORS issues by routing all the requests through ionic-native/http plugin.
@sneas thanks. Does it work with ionic v1?
@Bessonov sorry mate, I've just noticed you're working with ionic v1. It's actually for Ionic > v2.