Closed raisindetre closed 4 months ago
Hey @raisindetre! Great to see you diving into another challenge. How's everything going on your end?
To resolve the blocked:csp
error when downloading files, you need to include http://host.docker.internal:54321
in the connect-src
directive of your Content-Security Policy (CSP). This adjustment allows connections to the domain, which is necessary for the download process.
Here's how to update your CSP in the next.config.js
file:
const ContentSecurityPolicy = {
"connect-src": [
"'self'",
// Other domains
"http://host.docker.internal:54321", // Add this line
],
// ... other directives ...
};
After adding this domain, the CSP will permit connections to http://host.docker.internal:54321
, which should eliminate the download issue. Ensure you've located the CSP configuration correctly in your project's settings, typically found in the next.config.js
file or a similar configuration file depending on your setup.
Let me know if this solution works for you or if further assistance is needed.
Yes - as a hack I got things working by changing SUPABASE_URL
in .env to
http://[HOST_LAN_IP]:54321and editing
frontend/next.config.js` as shown:
const ContentSecurityPolicy = {
....
"connect-src": [
"'self'",
process.env.NEXT_PUBLIC_SUPABASE_URL,
process.env.NEXT_PUBLIC_BACKEND_URL,
process.env.NEXT_PUBLIC_CMS_URL,
"*.intercom.io",
"*.intercomcdn.com",
"https://api.june.so",
"https://api.openai.com",
"https://cdn.growthbook.io",
"https://vitals.vercel-insights.com/v1/vitals",
"https://us.posthog.com",
Add "http://[HOST_LAN_IP]:*",
to the end of this list then:
$ docker-compose stop frontend
$ docker-compose remove frontend
$ docker image prune -a
$ docker-compose build frontend
$ docker-compose up frontend
Log out, and back into Quivr UI. If getting UI error notifications and no content displayed. Stop and restart the whole quivr container in Docker.
Other values for SUPABASE_URL
might work but I got SEGFAULT errors from Yarn when trying to add http://host.docker.internal:54321
to the array and the original problem remained if I set it to http://localhost:54321
and relied on the defailt CSP directive which looks like:
"connect-src 'self' http://localhost:54321 http://localhost:5050 https://cms.quivr.app *.intercom.io *.intercomcdn.com https://api.june.so https://api.openai.com https://cdn.growthbook.io https://vitals.vercel-insights.com/v1/vitals https://us.posthog.com"
So setting SUPABASE_URL
to http://localhost:54321
should work but it doesn't... ¯_(ツ)_/¯
Thanks for your contributions, we'll be closing this issue as it has gone stale. Feel free to reopen if you'd like to continue the discussion.
What happened?
Trying to download files uploaded to a brain's knowledge resullts in a
blocked:csp
error in the browser preventing download. Disabling CSP in the browser enables the download to complete. The request URL is tohttp://host.docker.internal:54321
but the CSP directive does not include this domain. It includeshttp://localhost:54321
which also fails with CSP enabled but completes with it off.Generation of the request is clearly ok, but the code writing the CSP directive needs to be more permissive.
Relevant log output
Twitter / LinkedIn details
No response