# Client side fetching of external resources without app functions

**URL:** <https://community.dynatrace.com/t/client-side-fetching-of-external-resources-without-app-functions/53272>\
**Category:** Developer Q&A Forum\
**Tags:** custom-app, app-functions\
**Created:** [September 9, 2025, 2:20pm UTC](https://community.dynatrace.com/t/client-side-fetching-of-external-resources-without-app-functions/53272 "2025-09-09T14:20:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrik\_Potan\_ok](https://avatars.discourse-cdn.com/v4/letter/p/eada6e/32.png) [@Patrik\_Potan\_ok](https://community.dynatrace.com/u/Patrik_Potan_ok)\
**Post date:** [September 9, 2025, 2:20pm UTC](https://community.dynatrace.com/t/client-side-fetching-of-external-resources-without-app-functions/53272/1 "2025-09-09T14:20:07Z")

</div>

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. → [Mapbox GL JS | Mapbox](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?

---

<div class="post-metadata">

**Author:** ![dani\_coll](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dani_coll/32/33669_2.png) [@dani\_coll](https://community.dynatrace.com/u/dani_coll)\
**Post date:** [September 10, 2025, 1:06pm UTC](https://community.dynatrace.com/t/client-side-fetching-of-external-resources-without-app-functions/53272/2 "2025-09-10T13:06:04Z")

</div>

Hi Patrik,

It’s possible! You can use the **csp** &nbsp;attribute on your **app.config.json** like this

```javascript
{
  "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](https://developer.dynatrace.com/develop/security/configure-csp-rules/)

---

<div class="post-metadata">

**Author:** ![doesterr](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/doesterr/32/36076_2.png) [@doesterr](https://community.dynatrace.com/u/doesterr)\
**Post date:** [September 11, 2025, 2:44pm UTC](https://community.dynatrace.com/t/client-side-fetching-of-external-resources-without-app-functions/53272/3 "2025-09-11T14:44:09Z")

</div>

As an alternative to using Mapbox, check out strato-geo: [https://developer.dynatrace.com/design/geo/](https://developer.dynatrace.com/design/geo/)

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [September 11, 2025, 3:06pm UTC](https://community.dynatrace.com/t/client-side-fetching-of-external-resources-without-app-functions/53272/4 "2025-09-11T15:06:15Z")

</div>

[@doesterr](https://community.dynatrace.com/user/89527)&nbsp;, 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.

---

<div class="post-metadata">

**Author:** ![doesterr](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/doesterr/32/36076_2.png) [@doesterr](https://community.dynatrace.com/u/doesterr)\
**Post date:** [September 11, 2025, 3:08pm UTC](https://community.dynatrace.com/t/client-side-fetching-of-external-resources-without-app-functions/53272/5 "2025-09-11T15:08:11Z")

</div>

Makes sense, thanks for sharing!

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [September 11, 2025, 3:08pm UTC](https://community.dynatrace.com/t/client-side-fetching-of-external-resources-without-app-functions/53272/6 "2025-09-11T15:08:16Z")

</div>

[@dani\_coll](https://community.dynatrace.com/user/54539)&nbsp; we are also exploring the option to catch the fetch requests instread:

```javascript
// 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.&nbsp;We are trying to implement a service worker in an appengine app.&nbsp;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.&nbsp;What we have achieved is service worker javascript deployment in the assets subdirectory.&nbsp;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.&nbsp;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?

---

<div class="post-metadata">

**Author:** ![dani\_coll](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dani_coll/32/33669_2.png) [@dani\_coll](https://community.dynatrace.com/u/dani_coll)\
**Post date:** [September 15, 2025, 9:52am UTC](https://community.dynatrace.com/t/client-side-fetching-of-external-resources-without-app-functions/53272/7 "2025-09-15T09:52:50Z")

</div>

Hi Julius!

Unfortunately, as of now this is not supported and is only possible to have a single&nbsp;_main.js_ file. Hacking around it using the _assets_ subfolder is the only way but as you mentioned that’s not working for you.
