--- title: Modify network calls slug: '386' canonical_url: https://docs.coveo.com/en/386/ collection: javascript-search-framework source_format: adoc --- # Modify network calls [jsui-new Coveo JavaScript Search Framework v1.1550.5] In some very specific setups, it might be necessary to have finer control on all network calls before they're sent by the browser. For example, you might want to add or remove a special request header to pass to your network infrastructure. The Coveo JavaScript Search Framework offers a way to configure the search endpoint with a callback function to modify the [IRequestInfo](https://coveo.github.io/search-ui/interfaces/irequestinfo.html) object. > **Note** > > For high-level guidance on setting up a reverse proxy to route traffic to Coveo, see [Proxying traffic to Coveo: High-level guidance](https://docs.coveo.com/en/pbee0400/). ## When creating a new search endpoint In a scenario where you're creating your own endpoint, you would need to use the following example. Remember to replace `my-auth-token` with your authorization token. ```javascript Coveo.SearchEndpoint.endpoints['default'] = new Coveo.SearchEndpoint({ restUri : 'https://platform.cloud.coveo.com/rest/search', accessToken : 'my-auth-token', requestModifier : function(request) { // modify the method request.method = 'POST'; // delete a header delete request.headers.Authorization; // add a new header request.headers.Foo = 'bar'; // modify the URL request.url = 'somewhere.else.com'; return request; } }) ``` ## When modifying an existing search endpoint In some scenarios, such as when using Coveo for Salesforce, your search endpoint might already have been created for you. In this case, you would need to modify it using the following method. Remember to replace `my-auth-token` with your authorization token. ```javascript Coveo.SearchEndpoint.endpoints['default'] = new Coveo.SearchEndpoint({ restUri : 'https://platform.cloud.coveo.com/rest/search', accessToken : 'my-auth-token' }); var myRequestModifier = function(request) { // modify the method request.method = 'POST'; // delete a header delete request.headers.Authorization; // add a new header request.headers.Foo = 'bar'; // modify the URL request.url = 'somewhere.else.com'; return request; } // The setRequestModifier function exists on all SearchEndpoint ( https://coveo.github.io/search-ui/classes/searchendpoint.html ) Coveo.SearchEndpoint.endpoints['default'].setRequestModifier(myRequestModifier) ```