Ionic for IOS with Wordpress

I’m using ionic3 to build E-commerce app with Wordpress as a backend.
I’m using Woocommerce api to get products, orders, ect. this my code to configure it

import * as WC from "woocommerce-api";
Woocommerce = WC({
    url: this.url,
    consumerKey: this.consumerKey,
    consumerSecret: this.consumerSecret,
    wpAPI: true,
    queryStringAuth: true,
    version: "wc/v2"
 let query = "products?" + "page=" +;
    if (this.selected != "") query = "products?page=" +;
    query = query + "&status=publish" + "&" + this.config.productsArguments;
    this.config.Woocommerce.getAsync(query).then((data) => {

It worked on android Well but on Ios i have this error :
Failed to load resource: Origin httpsionic://localhost is not allowed by Access-Control-Allow-Origin.


Did you check if the headers are set by your web- or proxy-server? I guess you can’t easily override them in that case…

This is a good starting point - if the webserver is under your control. Otherwise you may have to talk to your hosting company.

@1antares1 ORS enabled this response headers using postman

access-control-allow-headers →Authorization, Content-Type
access-control-allow-methods →POST, GET, OPTIONS, PUT, DELETE
access-control-allow-origin →*
access-control-expose-headers →X-WP-Total, X-WP-TotalPages
allow →GET, POST
cache-control →no-transform, no-cache, no-store, must-revalidate
content-encoding →gzip
content-length →6009
content-type →application/json; charset=UTF-8
date →Fri, 11 Sep 2020 21:49:12 GMT
expires →Wed, 11 Jan 1984 05:00:00 GMT
link →<>; rel=""
pragma →no-cache
referrer-policy →no-referrer-when-downgrade
server →Apache
status →200
vary →Accept-Encoding,User-Agent
x-content-type-options →nosniff
x-powered-by →PHP/7.2.33
x-robots-tag →noindex
x-wp-total →6
x-wp-totalpages →1

@nazeeh Do not try Postman to validate the CORS since it runs itself from the Desktop (server) and “patches” certain things to let the Endpoint know that it is not a Browser directly as you do in Ionic.

Try to run the same from (previously called PostWoman) and confirm the answer, please.

@1antares1 response headers


Mmmm! Therefore, it is successfully enabled.

I ask myself because the host’s response is:
Origin httpsionic://localhost is not allowed by Access-Control-Allow-Origin.

That protocol, where did you get it?

Could you request that URL from the Hoppscotch inside an angular own http: this.http.get(); and valid?

I have some requests to same server and worked well the issue only in this module


but any endpoint else work well to the same server

In my server on htaccess file i set the following lines of code:

Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods: "*"
Header set Access-Control-Allow-Headers: "Origin, X-Requested-With, Content-Type, Accept, Authorization"

I get this error

Failed to load resource: Access-Control-Allow-Origin cannot contain more than one origin.


Why not check with the Fiddler App, which tries to do Woocommerce as opposed to Postman / Hoppscotch?

Trace all requests, show required metadata and information, and validate that such plugin is missing or lacking.