net::ERR_CONNECTION_REFUSED on device

Hello,
All work okey when I started my app in browser.
But when I did ionic run android and start it in Genymotion I get next problem:

Failed to load resource: net::ERR_CONNECTION_REFUSED

I use cordova-plugin-whitelist 1.2.2 “Whitelist” and have it in confix.xml:

 <access origin="*"> 
 <allow-navigation href="*" />

In my api server I use laravel with laravel-cors.

My code for cors.php:

<?php

return [
    /*
     |--------------------------------------------------------------------------
     | Laravel CORS
     |--------------------------------------------------------------------------
     |

     | allowedOrigins, allowedHeaders and allowedMethods can be set to array('*')
     | to accept any value.
     |
     */
    'supportsCredentials' => false,
    'allowedOrigins' => ['*'],
    'allowedHeaders' => ['*'],
    'allowedMethods' => ['*'],
    'exposedHeaders' => [],
    'maxAge' => 0,
    'hosts' => [],
];

How I can fix it? Thanks!

1 Like