Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache-Control is not working #9

Open
buddies2705 opened this issue May 30, 2020 · 1 comment
Open

Cache-Control is not working #9

buddies2705 opened this issue May 30, 2020 · 1 comment

Comments

@buddies2705
Copy link

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

@sfarthin
Copy link
Owner

sfarthin commented Jun 3, 2020

Sorry, I don't have the time to maintain this code. It is has been a long time since I looked at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants