# WebSDK redirect measurement request

**URL:** <https://community.cumulocity.com/t/websdk-redirect-measurement-request/2508>\
**Category:** Forum\
**Tags:** Angular, web-sdk, cumulocity\
**Created:** [June 12, 2024, 7:34am UTC](https://community.cumulocity.com/t/websdk-redirect-measurement-request/2508 "2024-06-12T07:34:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David.Richter](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@David.Richter](https://community.cumulocity.com/u/David.Richter)\
**Post date:** [June 12, 2024, 7:34am UTC](https://community.cumulocity.com/t/websdk-redirect-measurement-request/2508/1 "2024-06-12T07:34:46Z")

</div>

Hey guys,

I wondering if there is a way how I can redirect requests that I make via WebSDK.

My scenario. I have a Angular 16 application that uses the WebSDK. We have many parts in our code that use the MeasurementService from the WebSDK. Now I write a microserice that act as a fasade in front of the measurement api. We want use this microservice instead of the MeasurementService. Now I don’t want search for every snippet in the code that uses the MeasurementService to redirect them to my microservice. I want to redirect all GET requests to /measurement/measurements to my local running microservice.

This all is only for test purposes of my microservice, if still all requests handled proper.

First what I try was to write a interceptor in Angular. But the SDK don’t use the Angular HTTP Client so this was not working.  
Then I try to write a proxy.config that I can use in the angular.json (like this here [Angular](https://v16.angular.io/guide/build#proxying-to-a-backend-server)). But this is also not working. I guess this gets in conflict with the proxy settings for the cumulocity endpoint. When I try to login I get this error in browser:

```auto
{
  "status": 404,
  "statusText": "Not Found",
  "url": "http://localhost:4200/tenant/currentTenant"
}

```

Any other ideas how to redirect my GET call for measurements?

---

<div class="post-metadata">

**Author:** ![Tristan\_Bastian](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/tristan_bastian/32/18259_2.png) [@Tristan\_Bastian](https://community.cumulocity.com/u/Tristan_Bastian)\
**Post date:** [June 12, 2024, 8:38am UTC](https://community.cumulocity.com/t/websdk-redirect-measurement-request/2508/2 "2024-06-12T08:38:27Z")

</div>

Hi @David.Richter,

the tutorial application contains a `client-interceptor` sample that showcases intercepting requests done through the `@c8y/client` package.  
Note that this will not intercept requests coming from the `@c8y/ng1-modules` angularJS code.

Regards,  
Tristan

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [December 9, 2024, 8:38am UTC](https://community.cumulocity.com/t/websdk-redirect-measurement-request/2508/3 "2024-12-09T08:38:31Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
