How to allow cors in frappe cloud site
Go to site_config.json file and add this line:
{
“allow_cors”: “*”
}
From site_config in your site dashboard in Frappe Cloud, add new one for allow_cors
I don`t see it in Site Config, when i click + Add Config there is no option
You need to choose custom key
This is supposed to be working. However, I tried it out with no luck.
Also, SSHed to the bench and edited both
sites/common_site_config.json
sites/<mysite>/site_config.json
files but also no positive result.
I always get
access-control-allow-origin: https://<site-name>.frappe.cloud
when I run
curl -I -X GET https://<my-site>.frappe.cloud/api/method/some.endpoint
Anyideas?!
did you restarted the bench after this ? Usually these kind of changes will take effect after restarting the services.
Yes I tried to clear-cache
and clear-website-cache
and then restarted the whole bench. And still getting the same value in the access-control-allow-origin
header.
The issue was fixed when I updated the allow_cors
value to include the protocol part (not only the domain).
For example, https://my-domain.xyz
instead of my-domain.xyz
.
However, still not working for the wildcard *
or ["*"]
because the type now should be JSON, not String.