Access to fetch has been blocked by CORS policy

From Kolmisoft Wiki
Revision as of 06:16, 22 August 2023 by Nerijuss (talk | contribs) (Created page with "If you see such an error: Access to fetch at 'https://yourdomain.com/billing/api/user_calls_get?u=admin&hash=a1b2c3f4s5f6h7j8k9' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. add this line to /etc/httpd/conf.d/gui_ssl.conf ... ... <Directo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

If you see such an error:

Access to fetch at 'https://yourdomain.com/billing/api/user_calls_get?u=admin&hash=a1b2c3f4s5f6h7j8k9' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

add this line to /etc/httpd/conf.d/gui_ssl.conf

   ...
   ...
   <Directory /var/www/html/billing>
       Options -MultiViews
       Header set Access-Control-Allow-Origin http://127.0.0.1:5500
   </Directory>
   ...
   ...

Source:

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSAllowOriginNotMatchingOrigin