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

Can I use signed image URLs with a custom CDN? #3503

Closed
alexmacarthur opened this issue Nov 20, 2024 · 7 comments
Closed

Can I use signed image URLs with a custom CDN? #3503

alexmacarthur opened this issue Nov 20, 2024 · 7 comments
Labels
❓ Question Question regarding a specific subject

Comments

@alexmacarthur
Copy link

What are you trying to achieve?

I want to use an S3 bucket to host my uploaded images, but I do not want to make those links publicly available for anyone. Is it possible to have Stream use signed URLs with these images? Or I am I stuck with using Stream's CDN if I want to maximize security this way?

If possible, how can you achieve this currently?

I considered restricting bucket access to Stream's IPs, but I noticed that React implementations still use the direct CDN link (signed) in the browser, which means that won't work.

What would be the better way?

It'd be nice to be able to give Stream a unique identifier for a resource, and then easily override the UI components to generate a signed URL every time it's rendered. I hope I'm not missing some existing functionality there. That'd be embarrassing.

GetStream Environment

GetStream Chat version: 4.66.0
GetStream Chat frameworks: StreamChat, StreamChatUI, eventually React
iOS version: 17+
Swift version:
Xcode version: 16.1
Device: MacBook Pro M2 Max

Additional context

@nuno-vieira nuno-vieira added the ❓ Question Question regarding a specific subject label Nov 20, 2024
@nuno-vieira
Copy link
Member

Hi @alexmacarthur,

Yes, you can use a custom CDN and generate a custom URL as you like. You need to override the CDNClient in the iOS SDK. Here is the documentation: https://getstream.io/chat/docs/sdk/ios/client/custom-cdn/

Best,
Nuno

@alexmacarthur
Copy link
Author

@nuno-vieira Thanks - it looks like that only impacts the one-time upload, though. I could generate a signed URL that works for only 10 minutes, and then ever time it's rendered in the future (after 10 minutes), that custom link would be broken. As far as I can tell, I can't regenerate the URL each time it's rendered.

@nuno-vieira
Copy link
Member

@alexmacarthur How do you regenerate the URL, is it client-side or server-side?

@alexmacarthur
Copy link
Author

@nuno-vieira I presume I'd generating the URL on our server, and then providing that to the client. It'd very similar to how Stream generates its signed URLs.

image

@nuno-vieira
Copy link
Member

nuno-vieira commented Nov 20, 2024

Hi @alexmacarthur,

We also have ImageCDN protocol that you can override the URL when loading an image. I'm not sure if this will be any help here. But I'm afraid we do not support this scenario out of the box at the moment.

If ImageCDN is also not helpful, I recommend you contact our support to request this feature.

Best,
Nuno

@alexmacarthur
Copy link
Author

Thanks, @nuno-vieira! That ImageCDN protocol may be just what we need for our needs. I appreciate the help.

@nuno-vieira
Copy link
Member

nuno-vieira commented Nov 20, 2024

Thanks, @nuno-vieira! That ImageCDN protocol may be just what we need for our needs. I appreciate the help.

Nice! Please let us know if that worked for you so that we can update the documentation.

Best,
Nuno

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ Question Question regarding a specific subject
Projects
None yet
Development

No branches or pull requests

2 participants