Skip to content

Cache-Control is not working #9

@buddies2705

Description

@buddies2705

I am trying to set cache control, but it's not working

my bucket cors.

[
    {
      "origin": ["*"],
      "responseHeader": ["Content-Type", "access-control-allow-origin","Authorization", "Cache-Control"],
      "method": ["GET", "HEAD", "DELETE", "PUT", "POST"],
      "maxAgeSeconds": 3600
    }
]

I tried to set the cache-control while getting signed URL but then the image is not uploading.

Here is my front-end code

here using /api/product/image i am getting the singed URL and then pushing the image

   axios.get(`/api/product/image`, {
        params: {
          fileName: newImage.file.name
        }
      }).then((result) => {
        let imageForm = result.data
        let data = new FormData();
        data.append("key", imageForm.key);
        data.append("bucket", imageForm.bucket);
        data.append("GoogleAccessId", imageForm.GoogleAccessId);
        data.append("signature", imageForm.signature);
        data.append("policy", imageForm.policy);
        data.append("content-type", imageForm["Content-Type"]);
        data.append("file", newImage.file);
        let config = {
          headers: {
            'Content-Type': 'multipart/form-data',
            'Access-Control-Allow-Origin': '*'
          }
        }
        axios.post("https://" + imageForm.bucket + ".storage.googleapis.com",
          data, config).then((gresult) => 

If I set cache-control here in the headers field, then it's not working.

A StackOverflow question asking the similar problem, still unresolved

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions