Ionic, ios and htaccess


#1

I’m doing an app with ionic for android and ios, on android works fine, but on ios I have this problem:

The app is working with wordpress as backend, and I am using REST API, and JSON API, I need both because of some modifications in the wordpress (Not done by me) which make that some parts are more accesible with REST API an some WITH JSON API.

I have this two urls:

  1. https://www.xxxx.com/wp-json/wp/v2/saborear

  2. https://www.xxxx.com/idPost/?json=1

And also I have made some requests directly with PHP like this

  1. https://www.xxxx.com/usedTags.php

The first one works nice, the second one give me error.

I thought that it was a CORS problem, after inspect the headers, I could see that where different, this are the headers:

date: Wed, 20 Dec 2017 17:07:46 GMT

server: Apache

x-robots-tag: noindex

x-content-type-options: nosniff

access-control-expose-headers:X-WP-Total, X-WP-TotalPages

access-control-allow-headers: Authorization, Content-Type

x-wp-total:286

x-wp-totalpages:29

link:https://www.xxxx.com/wp-json/wp/v2/saborear?page=2; rel=“next”

allow:GET

transfer-encoding:chunked

content-type:application/json; charset=UTF-8

date:Wed, 20 Dec 2017 17:08:52 GMT

server:Apache

x-pingback:https://www.xxxx.com/xmlrpc.php

transfer-encoding:chunked

content-type:application/json; charset=UTF-8

date:Wed, 20 Dec 2017 17:09:27 GMT

server:Apache

access-control-allow-origin:*

transfer-encoding:chunked

content-type:application/json

So I changed my htaccess with:

Header set Access-Control-Allow-Origin “*”

This make that 1 and 3 stop working and 2 works.

And the headers now have this line:

access-control-allow-origin: * ; *

Any solution?

Thanks in advance.


#2

what error? can you show it?


#3

Yes, the error is:

Response with status: 0 for URL: null
{“position”:0,“totalSize”:0}

And when I change the htaccess this error goes for 1 and 3.


#4

can you provide the code for the site that is not working? I need more onformation to help you.