Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
1602 Ansichten

Hi All,


We are trying to call REST API from WeWeb and we face below issue from Odoo, if any one has solution, can you please give us details ?

====

access to XMLHttpRequest at 'http://XX.XXX.XXX.XX' 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.

====

Thanks,

Mustufa

Avatar
Verwerfen
Beste Antwort

Hi Mustufa,

This is a classic CORS (Cross-Origin Resource Sharing) issue. In Odoo, you’ll need to enable CORS headers on your server.

If you’re running Odoo behind a web server like Nginx, add something like:

nginx

CopyEdit

add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; add_header Access-Control-Allow-Headers '*';

Or, if you’re using Odoo’s built-in server, look into middleware solutions or a proxy to inject CORS headers.

Also, check that your API route allows OPTIONS preflight requests and responds correctly.

Hope this helps!

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Juli 25
4280
0
März 15
4142
1
Apr. 25
1106
2
Sept. 24
2462
1
Juli 25
1882