Just a quick note for anyone struggling with CORS: @revant_one’s modifications to nginx.conf work great, but at least in some circumstances they apply the necessary headers only to successful API calls. That means, if the call fails for some other reason (403, 404, 500, etc.), you might get a misleading Access-Control-Allow-Origin
error.
In other words, if you’re still getting Access-Control-Allow-Origin
errors even after you’ve changed frappe-bench/config/nginx.conf
and reloaded nginx, it’s very possible that CORS isn’t actually the problem but being reported as a false positive. Adding this in hopes of saving someone else some trouble.
Signed,
Someone who learned the hard way