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

Set Content-Security-Policy in Gatsby to allow loading content in Storybook #778

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

brentswisher
Copy link
Contributor

@brentswisher brentswisher commented Jul 19, 2024

This change: (check at least one)

  • Adds a new feature
  • Fixes a bug
  • Improves maintainability
  • Improves documentation
  • Is a release activity

Is this a breaking change? (check one)

  • Yes
  • No

Is the: (complete all)

  • Title of this pull request clear, concise, and indicative of the issue number it addresses, if any?
  • Test suite(s) passing?
  • Code coverage maximal?
  • Changeset added?
  • Component status page up to date?

What does this change address?
When updating to Gatsby 5 we inadvertently broke some storybook pages. It will no longer load any content for the stories, returning a 404 with an error like Refused to display 'https://pharos.jstor.org/' in a frame because it set 'X-Frame-Options' to 'deny'.

How does this change work?
Sets the Content-Security-Policy of pharos.jstor.org to all content from any jstor page. It appears that in Gatsby 5 Netlify automatically injects it's adapter, which sets the headers to deny. (thread, documentation)

Additional context
I used this documentation to create the header value, but I'm not overly familiar with this header, so let me know if there is a better option!

@brentswisher brentswisher requested a review from a team as a code owner July 19, 2024 12:46
@brentswisher brentswisher requested review from daneah, sirrah-tam and mtorres3 and removed request for a team July 19, 2024 12:46
Copy link

changeset-bot bot commented Jul 19, 2024

🦋 Changeset detected

Latest commit: 8d86599

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@ithaka/pharos-site Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentswisher
Copy link
Contributor Author

Screenshot 2024-07-19 at 8 47 20 AM

Copy link
Contributor

github-actions bot commented Jul 19, 2024

size-limit report 📦

Path Size
packages/pharos/lib/index.js 64.73 KB (0%)

@brentswisher brentswisher merged commit 5fc4213 into develop Jul 19, 2024
7 checks passed
@brentswisher brentswisher deleted the fix/storybook-not-displaying branch July 19, 2024 13:02
@github-actions github-actions bot mentioned this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants