Access to XMLHttpRequest has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Kaushal Shriyan kaushalshriyan at gmail.com
Thu May 28 07:20:34 UTC 2020


Hi,

I am running Nginx version: nginx/1.16.1 on CentOS Linux release 7.8.2003
(Core) and have hosted react.js javascript 16.13.1 and Drupal CMS Framework
8.7.8.
https://tmobilereactdrupal.mydomain.com (react.js javascript 16.13.1) which
in turn talks to https://tmobilereactdrupal.mydomain.com:8080 (drupal
framework version 8.7.8). Both react js on port 443 (frontend) and drupal
cms on port 8080 (backend) are running on the same Nginx webserver.

When I hit https://tmobilereactdrupal.mydomain.com (react.js framework
frontend on the port 443) connects to
https://tmobilereactdrupal.mydomain.com:8080 (Drupal CMS 8.7.8 backend on
the port 8080)
I am encountering the below error in Developer tools console which is a
plugin in the browser.

Access to XMLHttpRequest at ‘
> https://tmobilereactdrupal.mydomain.com:8080/oauth/token’ from origin ‘
> https://tmobilereactdrupal.mydomain.com’ has been blocked by CORS policy:
> No ‘Access-Control-Allow-Origin’ header is present on the requested
> resource.


I have attached both the Nginx config file for the react.js framework
(frontend) and Drupal CMS 8.7.8 backend. Any help will be
highly appreciated. I have added  add_header 'Access-Control-Allow-Origin'
'*' always; in nginx.conf and is not honoring the settings. I look forward
to hearing from you. Thanks in advance.

Best Regards,

Kaushal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20200528/f88a4b5a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reactjsnginx.conf
Type: application/octet-stream
Size: 2720 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20200528/f88a4b5a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drupalcmsnginx.conf
Type: application/octet-stream
Size: 2017 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20200528/f88a4b5a/attachment-0001.obj>


More information about the nginx mailing list