09 Sep 2025 03:20 PM
Hi everyone,
I would like to ask a question about the limitations of the dynatrace app with the external requests.
I have read the documentation on how to fetch data from external resources using app functions, but it looks like I can't use this approach for my project.
I would like show a map in my dynatrace app using mapbox api based on data (coordinates) from our dynatrace events.
Mapbox provides a client-side JavaScript library, that manages all the network communication to their apis, and uses an element from the page document, to render the map. -> https://docs.mapbox.com/mapbox-gl-js/guides
From what I've read so far, the function that renders the map doesn't have a way to extract fetching of the resources outside, and needs to have access to the web page document, therefore I can't use the app function.
So I would like to ask, is there a way, how to configure the dynatrace app so that so it can fetch resources from external domains?
10 Sep 2025 02:06 PM
Hi Patrik,
It's possible! You can use the csp attribute on your app.config.json like this
{
"environmentUrl": "<Your-Environment-URL>",
"app": {
"id": "<Your-App-ID>",
"name": "<Your-App-Name>",
"version": "0.0.0",
"description": "<Your-App-Description>",
"scopes": [],
"csp": {
"img-src": [
{
"value": "https://awesome-cdn.net",
"comment": "allows to load images from awesome CDN"
}
],
"font-src": [
{
"value": "https://font-paradise.com",
"comment": "allows to load fonts from font paradise"
}
]
}
}
}
You can find more information here
11 Sep 2025 04:08 PM
@dani_coll we are also exploring the option to catch the fetch requests instread:
// sw.js
self.addEventListener('fetch', (event) => {
const url = new URL(event.request.url);
// Example: reroute Mapbox requests through your backend
const mapboxHosts = ['api.mapbox.com', 'events.mapbox.com', 'tiles.mapbox.com'];
if (mapboxHosts.includes(url.hostname)) {
const proxy = new URL('/proxy', self.location.origin);
proxy.searchParams.set('u', event.request.url); // original URL encoded
event.respondWith(fetch(proxy, {
method: event.request.method,
headers: event.request.headers,
body: event.request.method !== 'GET' && event.request.method !== 'HEAD'
? event.request.blob()
: undefined,
// credentials behavior mirrors the original by default
}));
return;
}
// Default pass-through
event.respondWith(fetch(event.request));
});
However we could not get this to work. We are trying to implement a service worker in an appengine app. We are having problems with including a service worker javascript implementation with the app bundle at the same directory level as is the compiled main.js file. What we have achieved is service worker javascript deployment in the assets subdirectory. This is not sufficient since the service worker is not able to intercept certain events from main.js when deployed in a subdirectory - to intercept them the implementation of the service worker must be in the same directory as main.js. How can we configure the app build so that it includes a javascript file in the same directory as main.js in the final deployment structure?
15 Sep 2025 10:52 AM
Hi Julius!
Unfortunately, as of now this is not supported and is only possible to have a single main.js file. Hacking around it using the assets subfolder is the only way but as you mentioned that's not working for you.
11 Sep 2025 03:44 PM
As an alternative to using Mapbox, check out strato-geo: https://developer.dynatrace.com/design/geo/
11 Sep 2025 04:06 PM
@doesterr , the provided geo components do not provide the required detail, such as cities or streets, we need to have much more detail on maps in this particular case. This option has been explored already, and the customer has a mapbox subscription.
11 Sep 2025 04:08 PM
Makes sense, thanks for sharing!