Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google CLOUD Signed URL, unable to Upload File if it is larger than 2 MB, CORS error

CORS set done to my bucket.

[{"maxAgeSeconds": 3600, "method": ["OPTIONS", "GET", "POST", "PUT", "HEAD"], "origin": ["*"], "responseHeader": ["Content-Type", "Access-Control-Allow-Headers", "Access-Control-Allow-Origin"]}] 

I'm able to upload with same code since 2 years, since 10 days it fails to upload.

Using Jquery blueimp fileupload, Post Method. (CORS error)

Using Postman tool, file is uploading with Post Request.

 

PHP CODE to Generate Signed URL : 

$url = $object->signedUrl(new \DateTime('30 min'),['method' => 'POST','allowPost' => true,'version' => 'v4', 'x-goog-content-length-range' => "0,1000000000"]);

 

Console Error Response

Access to XMLHttpRequest at 'https://storage.googleapis.com/' from origin 'https://admin.example.domain' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

 

0 0 1,766