I've tried searching for the answer, but all CORS related questions seem to be about accessing files on another server.
In my case, I have successfully deployed a flutter web to my server in /public_html/.
Using file manager on my web hosting, I then added an "images" folder, in the same directory. The images in this folder are uploaded by users, and so cannot be created during production.
I would like to allow access so the images in this folder accessible by other server requests without CORS restrictions, but only to this folder.
This restriction is generated by flutter web and not my web hosting, because prior to deploying the flutter web, I was able to access the images using image.network widget.
Managed to find quite an easy solution, just be creating an .htaccess file in the images folder, and adding the following to it:
RewriteEngine On
<FilesMatch "\.(jpg)$">
Header add Access-Control-Allow-Origin "*"
</FilesMatch>