<?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 http requests got blocked by CORS policy in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12237#M5392</link>
    <description>&lt;P&gt;I'm trying to make a get request from ADF to Alfresco comunity 7.0. Here is the code:&lt;/P&gt;&lt;PRE&gt;export class MydatatableComponent implements OnInit {


  
  constructor() {
    const alfrescoApi = new AlfrescoApi({
      hostEcm: 'http://localhost:8080'
    });
    
    
    const peopleApi = new PeopleApi(alfrescoApi);

    const opts = { 
      'skipCount': 56, /*  | The number of entities that exist in the collection before those included in this list.
    If not supplied then the default value is 0.
     */
      'maxItems': 56 
    };
    
    peopleApi.listPeople().then((data) =&amp;gt; {
      console.log('API called successfully. Returned data: ' + data);
    }, function(error) {
      console.error(error);
    });
    
}&lt;/PRE&gt;&lt;P&gt;and here is the error I get from the console:&lt;/P&gt;&lt;PRE&gt;Access to XMLHttpRequest at 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/people' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.&lt;/PRE&gt;&lt;P&gt;and this my proxy.conf.js&lt;/P&gt;&lt;PRE&gt;module.exports = {
  
  "/alfresco/*": {
    "target": "http://localhost:8080",
    "secure": false,
    "changeOrigin": true
  }
};&lt;/PRE&gt;&lt;P&gt;I did download&amp;nbsp;enablecors-1.0 and copied it to modules/platform but it didn't work.&lt;/P&gt;&lt;P&gt;What is the problem and how I can fixit?&lt;/P&gt;&lt;P&gt;PS: I also tried to use&amp;nbsp;apiService.getInstance().webScript.executeWebScript&lt;/P&gt;&lt;P&gt;and it didn't work.&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
    <pubDate>Sun, 16 Jan 2022 08:48:29 GMT</pubDate>
    <dc:creator>KarekMedAM</dc:creator>
    <dc:date>2022-01-16T08:48:29Z</dc:date>
    <item>
      <title>http requests got blocked by CORS policy</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12237#M5392</link>
      <description>&lt;P&gt;I'm trying to make a get request from ADF to Alfresco comunity 7.0. Here is the code:&lt;/P&gt;&lt;PRE&gt;export class MydatatableComponent implements OnInit {


  
  constructor() {
    const alfrescoApi = new AlfrescoApi({
      hostEcm: 'http://localhost:8080'
    });
    
    
    const peopleApi = new PeopleApi(alfrescoApi);

    const opts = { 
      'skipCount': 56, /*  | The number of entities that exist in the collection before those included in this list.
    If not supplied then the default value is 0.
     */
      'maxItems': 56 
    };
    
    peopleApi.listPeople().then((data) =&amp;gt; {
      console.log('API called successfully. Returned data: ' + data);
    }, function(error) {
      console.error(error);
    });
    
}&lt;/PRE&gt;&lt;P&gt;and here is the error I get from the console:&lt;/P&gt;&lt;PRE&gt;Access to XMLHttpRequest at 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/people' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.&lt;/PRE&gt;&lt;P&gt;and this my proxy.conf.js&lt;/P&gt;&lt;PRE&gt;module.exports = {
  
  "/alfresco/*": {
    "target": "http://localhost:8080",
    "secure": false,
    "changeOrigin": true
  }
};&lt;/PRE&gt;&lt;P&gt;I did download&amp;nbsp;enablecors-1.0 and copied it to modules/platform but it didn't work.&lt;/P&gt;&lt;P&gt;What is the problem and how I can fixit?&lt;/P&gt;&lt;P&gt;PS: I also tried to use&amp;nbsp;apiService.getInstance().webScript.executeWebScript&lt;/P&gt;&lt;P&gt;and it didn't work.&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jan 2022 08:48:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12237#M5392</guid>
      <dc:creator>KarekMedAM</dc:creator>
      <dc:date>2022-01-16T08:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: http requests got blocked by CORS policy</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12238#M5393</link>
      <description>&lt;P&gt;Try using this setting in Alfresco Repository:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="caret-color: #0a3069; color: #0a3069; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration: none; display: inline !important; float: none;"&gt;csrf.filter.enabled=false&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;You may add this property to&lt;STRONG&gt; alfresco-global.properties&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2022 09:00:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12238#M5393</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2022-01-17T09:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: http requests got blocked by CORS policy</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12239#M5394</link>
      <description>&lt;P&gt;I did add&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;csrf.filter.enabled=false&lt;/EM&gt; to my&amp;nbsp;&lt;STRONG&gt;alfresco-global.properties &lt;/STRONG&gt;and got the same error&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/123iCC59B887008DF4A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jan 2022 09:21:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12239#M5394</guid>
      <dc:creator>KarekMedAM</dc:creator>
      <dc:date>2022-01-18T09:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: http requests got blocked by CORS policy</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12240#M5395</link>
      <description>&lt;P&gt;Some additional info can be found here:&amp;nbsp;&lt;A href="https://hub.alfresco.com/t5/application-development/adf-cors-solving-strategies/bc-p/311055#M272" target="_blank" rel="nofollow noopener noreferrer"&gt;https://hub.alfresco.com/t5/application-development/adf-cors-solving-strategies/bc-p/311055#M272&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 14:45:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12240#M5395</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2022-01-20T14:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: http requests got blocked by CORS policy</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12241#M5396</link>
      <description>&lt;P&gt;You proxy target needs to point to a remote ACS. So that your app calls localhost that is redirected by proxy. In your example, your proxy is having incorrect target and points to self&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 09:22:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/http-requests-got-blocked-by-cors-policy/m-p/12241#M5396</guid>
      <dc:creator>denys</dc:creator>
      <dc:date>2023-07-18T09:22:28Z</dc:date>
    </item>
  </channel>
</rss>

