How to avoid cors error when call json rpc from browser? I want to play with rpc for this I create some html page on my local PC and try to follow JsonRpcHowTo. I know for ubus cors can be disabled with some option. But I can't find similar option for luci/rpc. So what exactly I need.
(await axios.post('https://router/cgi-bin/luci/rpc/auth', {
id: 1,
method: 'login',
params: [
'root',
'111111',
]
}))
Exception
Access to XMLHttpRequest at 'https://router/cgi-bin/luci/rpc/auth' from origin 'https://localhost:4200' 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