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

Content-Security-Policy and loading HTML apps with Artifacts #158

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seajoshc
Copy link

@seajoshc seajoshc commented Nov 2, 2024

I put LibreChat on a VPS and was trying out the Artifacts feature but noticed the apps wouldn't load. The right panel would show:

"This content is blocked. Contact the site owner to fix the issue."

and then

Couldn't connect to server

This means sandpack cannot connect to the runtime or your network is having some issues. Please check the network tab in your browser and try again. If the problem persists, report it via email or submit an issue on GitHub.

ENV: create-react-app
ERROR: TIME_OUT

Checking network tab in Chrome dev tools I was seeing:

Refused to frame 'https://2-18-2-sandpack.codesandbox.io/' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback.

I updated my web server's Content-Security-Policy to include frame-src 'self' https://*.codesandbox.io and that fixed the issue. I figured I would document that here for others.

I put LibreChat on a VPS and was trying out the Artifacts feature but noticed the apps wouldn't load. The right panel would show:

```
"This content is blocked. Contact the site owner to fix the issue."
``` 

and then

```
Couldn't connect to server

This means sandpack cannot connect to the runtime or your network is having some issues. Please check the network tab in your browser and try again. If the problem persists, report it via email or submit an issue on GitHub.

ENV: create-react-app
ERROR: TIME_OUT
```

I updated my web server's Content-Security-Policy to include `frame-src 'self' https://*.codesandbox.io` and that fixed the issue. I figured I would document that here for others.
Copy link

vercel bot commented Nov 2, 2024

@seajoshc is attempting to deploy a commit to the LibreChat-AI Team on Vercel.

A member of the Team first needs to authorize 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

Successfully merging this pull request may close these issues.

1 participant