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

Issue rendering images on nodes when hosting own node with GCP_BUCKET #71

Closed
MirekR opened this issue Jul 16, 2021 · 12 comments
Closed

Comments

@MirekR
Copy link

MirekR commented Jul 16, 2021

Hey there, we have setup our node, setup GCP_BUCKET_NAME and GCP_CREDENTIALS_PATH, we're able to upload images to the GCP_BUCKET without issue,

So far so good, buut
I had to update the Caddy file to be able to display images from our bucket to mitigate CSP blocking on our node (adding our bucket address to the img-src - see the Caddyfile attached) . After that, we can display images on our own node, but other nodes (starting with bitclout.com) are not loading images with error "(blocked:csp)". Is there a way how to enable images from our gcp bucket or what is general approach to this when you host your own node and bucket storage?

Post example:
Our, working, node:
https://node.flickapp.com/posts/8b2877038285a0e2ed59caa3228305f9e91ae0aee68a34ca2d2ac6a82a3530b3

Bitclout node, same post is not displaying image with - (blocked:csp)
https://bitclout.com/posts/8b2877038285a0e2ed59caa3228305f9e91ae0aee68a34ca2d2ac6a82a3530b3

Any advice what we can setup to avoid image breakdown on other nodes?

Caddyfile.dev.txt

Thanks for any advice.

@tijno
Copy link
Contributor

tijno commented Jul 16, 2021

i think the only option is to either allow a the generic google bucket domain on all nodes, or allow any domain for image embeds on all nodes (eg disabled csp for images)

@marnimelrose
Copy link

marnimelrose commented Jul 16, 2021

So if you watch this quick video, you will notice that if you set up with no credentials and just use images.bitclout.com that the images will post fine on your node and all others
https://www.loom.com/share/46b85cfddb934d2ba72e1b06279789c5
BTW - I just hid that post, I just wanted you to see it for yourself in the video.

@maebeam
Copy link
Member

maebeam commented Jul 17, 2021

@MirekR I would recommend using the bitclout.com upload-image endpoint.

@MirekR
Copy link
Author

MirekR commented Jul 17, 2021

@maebeam I guess we can use it but what is the point allowing to change the bucket then?

@marnimelrose thanks for the video but not sure it that’s 100% correct. The node front end seems to be using the bitclout.com uplod-image endpoint (as maebeam suggested to use as well) regardless of the settings. Issue arise when you try to call the upload-image endpoint (from mobile app for example). If you set it up as you suggest, it fails the upload.

@tijno
Copy link
Contributor

tijno commented Jul 17, 2021

@maebeam ive seen reports that using the default bitclout one does not work from non bitclout.com nodes - but have not tested this myself.

will test today

@maebeam
Copy link
Member

maebeam commented Jul 18, 2021

@tijno Let me know if you get CORS. I am happy to turn off CORS for that endpoint.

@tijno
Copy link
Contributor

tijno commented Jul 18, 2021

Looks like it maybe @maebeam - although this could relate to my CSP on frontend but I do have bitclout.com:* in my connect-src so it should be able to make requests to https://bitclout.com/api/v0/upload-image

20210718-4qQA27OO

@maebeam
Copy link
Member

maebeam commented Jul 18, 2021

That looks like a CSP error to me

@MirekR
Copy link
Author

MirekR commented Jul 18, 2021

@tijno you might want to change image-src, not connect-src to make it work?

@tijno
Copy link
Contributor

tijno commented Jul 18, 2021

its the api upload req to bitclout.com that fails - cant get csp update in Caddyfile to stick somehow so still waiting to rule out csp issue on my end

@tijno
Copy link
Contributor

tijno commented Jul 22, 2021

The issue on my end was that bitclout.com was no longer in my Caddyfile CSP section and cloudflare caching was delaying any changes from showing up.

20210722-t30Okuul

@MirekR All working correctly now and I was able to post images from my node using the default empty GCP_BUCKET in the dev.env file so it uses images.bitclout.com

@maebeam
Copy link
Member

maebeam commented Aug 24, 2021

I'm going to close this since it appears everything is working as intended.

@maebeam maebeam closed this as completed Aug 24, 2021
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

4 participants