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

BUG: "Open in StackBlitz” button broken by CORS #226

Open
coder0107git opened this issue Jul 27, 2024 · 5 comments · May be fixed by #229
Open

BUG: "Open in StackBlitz” button broken by CORS #226

coder0107git opened this issue Jul 27, 2024 · 5 comments · May be fixed by #229
Assignees
Labels
triage new issues that need to be assigned

Comments

@coder0107git
Copy link

Describe the bug
When the "Open in StackBlitz" button is requested with CORS (i.e. <img crossorigin="anonymous" ...>), it isn't loaded.

To Reproduce
Steps to reproduce the behavior:

  1. Run the following HTML
<!-- Broken badge -->
<img alt="Open in StackBlitz" 
     crossorigin="anonymous" 
     src="https://developer.stackblitz.com/img/open_in_stackblitz_small.svg">

<!-- Working badge-->
<img alt="Open in StackBlitz"  
     src="https://developer.stackblitz.com/img/open_in_stackblitz_small.svg">
  1. Open the DevTools Console tab
  2. See error

Expected behavior
For the image to load.

Screenshots
An "Open in StackBlitz" image not loading and one loading
Chrome DevTool error message saying "Access to image at 'https://developer.stackblitz.com/img/open_in_stackblitz_small.svg' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."

Desktop:

  • OS: Windows
  • Browser: Chrome
  • Version: 126

Additional context

@coder0107git coder0107git added the triage new issues that need to be assigned label Jul 27, 2024
@coder0107git
Copy link
Author

A potential fix for this would be to add the following to netlify.toml.

[[headers]]
  for = "/img/*"
  [headers.values]
    Cross-Origin-Resource-Policy = "cross-origin"
+   Access-Control-Allow-Origin = "*"

@coder0107git
Copy link
Author

Would submitting a PR with the suggested changes be helpful?

@samdenty
Copy link
Member

Sure @coder0107git

@coder0107git coder0107git linked a pull request Aug 28, 2024 that will close this issue
@coder0107git
Copy link
Author

Filed PR (#229)

@coder0107git
Copy link
Author

@samdenty or @sulco Any chance #229 will be reviewed soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage new issues that need to be assigned
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants