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

[SOLVED] Not works with Google Cloud Storage images URLS #124

Closed
joaom182 opened this issue Jul 25, 2020 · 3 comments
Closed

[SOLVED] Not works with Google Cloud Storage images URLS #124

joaom182 opened this issue Jul 25, 2020 · 3 comments

Comments

@joaom182
Copy link

I'm trying to render a gallery imagem from Google Cloud Storage, and when lightbox open, return "Invalid source".

Example of image URL
https://storage.googleapis.com/sellers-pictures/f1305769-2965-43ba-ba30-cd7a8ce2a647.jpg

Screen Shot 2020-07-25 at 10 15 59

@ffd8
Copy link

ffd8 commented Jul 25, 2020

Just ran into similar issue with a cloud bucket – could either be a CORS issue, or maybe you just need to specify it's an image, adding data-type="image" to the <a> tag...

@joaom182
Copy link
Author

joaom182 commented Jul 25, 2020

@ffd8 yeah i've confirmed, it's a CORS issue. But when i render inline <img /> tag, the image is rendered. But when i open the light box, throw the CORS issues on console.

I'm trying to configure cloud bucket to works with wildcard origin CORS, but it's not working.

@joaom182
Copy link
Author

@ffd8 i've found the solution.

Create a json file, ex: storage-settings.json with the content:

[
  {
    "origin": ["*"],
    "method": ["GET", "OPTIONS"],
    "responseHeader": [
      "Origin",
      "Accept",
      "X-Requested-With",
      "Authorization",
      "Content-Type",
      "Content-Length",
      "Accept-Encoding",
      "X-CSRF-Token"
    ],
    "maxAgeSeconds": 1
  }
]

Apply this file to configure CORS on your bucket running the command:

gsutil cors set [PATH_TO_JSON_FILE] gs://[BUCKET_NAME]

@joaom182 joaom182 changed the title Not works with some image urls [SOLVED] Not works with Google Cloud Storage images URLS Jul 25, 2020
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