So, I have a subdomain, which is the API endpoint for uploading files. But when I try to upload something with jQuery to this subdomain (from the main www domain), I get an error
XMLHttpRequest cannot load http://1.storage.site.net/upload . The origin of http://www.site.net is not permitted by Access-Control-Allow-Origin.
I tried everything: headers in nginx, headers in the source code, I even tried to send the file to the stub file only with
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Content-type: application/json');
header('Access-Control-Allow-Headers: *');
echo json_encode(['lulz' => 123]);
In a nutshell: NOTHING WORK.
BUT. I noticed that small files (~ 1 MB) load correctly and the files are slightly larger (say 5 MB) - NOT (origin is not allowed).
Is there any way to solve this?