<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Esri-arcgis request intercept based on wildcard route in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-arcgis-request-intercept-based-on-wildcard/m-p/1006342#M70966</link>
    <description>&lt;P&gt;Can you try changing it to a regex, like this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;esriConfig.request.interceptors.push({
  urls: [/\/backend\/api\//],
  ...
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I don't think you even need the wildcard, but if you used the full domain, like "https://myserver/backend/api" it should get recognized. We don't parse for wildcards, but will check if the request url starts with a string or test a regex you provide.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Dec 2020 20:48:26 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2020-12-02T20:48:26Z</dc:date>
    <item>
      <title>Esri-arcgis request intercept based on wildcard route</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-arcgis-request-intercept-based-on-wildcard/m-p/1006134#M70958</link>
      <description>&lt;P&gt;I'm trying to implement a MapLayer in my react application. The map is only accessible over a proxy which needs authentication to identify the users for each end every request.&lt;/P&gt;&lt;P&gt;To provide the token i added the following request interceptor to make sure all calls which access that backend would be expanded by the authorization. If i do it this way there is no header added to the requests.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;esriConfig.request.interceptors.push({
  urls: ['backend/api/*'],
  before: async function (params: any) {
    params.requestOptions.headers = {
      Authorization: 'Bearer ' + token),
    };
  },
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i remove the urls parameter so that all routes are extended with the token I'll recieve some cors errors because the esri package also makes some calls to another api where i get blocked because i'm sending an authorization header which is not expected.&lt;/P&gt;&lt;P&gt;Other api: &lt;A href="https://www.arcgis.com/sharing/rest/portals/self?f=json&amp;amp;culture=de-de" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.arcgis.com/sharing/rest/portals/self?f=json&amp;amp;culture=de-de&lt;/A&gt;&lt;/P&gt;&lt;P&gt;How can i make sure only requests to my api will be extended with the autorization header?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 12:24:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-arcgis-request-intercept-based-on-wildcard/m-p/1006134#M70958</guid>
      <dc:creator>yzimmermann</dc:creator>
      <dc:date>2020-12-02T12:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Esri-arcgis request intercept based on wildcard route</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-arcgis-request-intercept-based-on-wildcard/m-p/1006342#M70966</link>
      <description>&lt;P&gt;Can you try changing it to a regex, like this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;esriConfig.request.interceptors.push({
  urls: [/\/backend\/api\//],
  ...
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I don't think you even need the wildcard, but if you used the full domain, like "https://myserver/backend/api" it should get recognized. We don't parse for wildcards, but will check if the request url starts with a string or test a regex you provide.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 20:48:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-arcgis-request-intercept-based-on-wildcard/m-p/1006342#M70966</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2020-12-02T20:48:26Z</dc:date>
    </item>
  </channel>
</rss>

