S
S
Sergey Zolotarev2022-04-06 16:01:29
CORS
Sergey Zolotarev, 2022-04-06 16:01:29

How to allow incoming https requests in cordova browser mode?

Good evening!

I am facing running Mapbox GL JS in my Cordova application. The map does not fully run on localhost, since the API itself is available via HTTPS. And DevTools complains for such reasons:

Content Security Policy: Параметры страницы заблокировали загрузку ресурса data:image/webp;base64,UklGRh4AAABXRUJQV… («default-src»). webp_supported.js:28:4

Content Security Policy: Параметры страницы заблокировали загрузку ресурса https://api.mapbox.com/mapbox-gl-js/v2.7.0/mapbox-gl.css («style-src»).

Content Security Policy: Параметры страницы заблокировали загрузку ресурса blob:http://localhost:8002/25950ee2-1382-4fcb-813d-b3113486327f («script-src»). 2

Запрос из постороннего источника заблокирован: Политика одного источника запрещает чтение удаленного ресурса на https://events.mapbox.com/events/v2?access_token=... . (Причина: не удалось выполнить запрос CORS).

In the meta tag, I configured the policy like this:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' *">

And in the config.xml of the application project:
<access origin="*" />
<allow-navigation href="*"/>
<allow-intent href="*"/>


Have you experienced this? If so, please share how to resolve this issue!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question