A project uses the Canvas label of Html5. The picture displayed by canvas comes from subdomain, api.xx.com. The domain of the current page is m.xx.com. Once called through JS: canvas.toDataURL (), cross-domain problems will be reported:
Redirect at origin ‘http://api.xx.com‘ has been blocked from loading by Cross-Origin Resource Sharing policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://m.xx.com‘ is therefore not allowed access.
Does UPYUN have any relevant solutions, or can it add Access-Control-Allow-Origin open control to the header of cross-domain requests for pictures?
How to add Access-Control-Allow-Origin to the header of the requested picture?
I have encountered this problem before, and it is also a different cross-domain in subdomain, because the pictures used are not on the same server.
The solution adopted at that time was to obtain the content of the picture file through the server and then output it on the html page. In this way, the cross-domain problem of the picture can be solved. (But maybe irrelevant to the subject! )