I'm trying to build an application on Cordova. All is well. App is assembled and successfully launched in the emulator. The problem arose when I want to make an AJAX request to the local server.
By the way, the server is on ExpressJS and it has cross domain requests enabled. Also in / etc / hosts is a link to "127.0.0.1 test.loc"
In the settings of Cordova in the file config.xml is written
<plugin name="cordova-plugin-whitelist" spec="1" /> <access origin="*" /> <access origin="http://test.loc*" /> In the index.html set the tag
<meta http-equiv="Content-Security-Policy" content="default-src *; connect-src *"> For jQuery spelled flag
$.support.cors = true; I make a build, run the emulator. I am connected by the console for debag. I make a request to the server
http://test.loc:3000/api/auth/login And I get an error
POST http://test.loc:3000/api/auth/login net::ERR_NAME_NOT_RESOLVED Further thoughts ran out. Google didn't help either. All that was found did not help. If anyone came across, tell me where to dig?