flyerhq / flutter_link_previewer

Customizable link and URL preview extracted from the provided text with the ability to render from the cache. Ideal for chat applications.
MIT License
72 stars 75 forks source link

CORS policy #33

Closed gbaccetta closed 2 years ago

gbaccetta commented 2 years ago

On flutter WEB I'm getting CORS policy error. Other requests I use in my app work properly. What am I doing wrong ?

I used the code from the sample and tried with www.google.com

demchenkoalex commented 2 years ago

Hey @gbaccetta this is how the web works, you will need your own proxy server to get around this, there is no other way.

gbaccetta commented 2 years ago

Hi @demchenkoalex thank you for your answer. Yeah I was guessing as much. I was thinking of using firebase cloud functions that are already implemented in my apps, but I was not sure on a to change the request that is performed in the onPreviewDataFetched to achieve that. How can I override the method ? I wish to do it conditionnally using the kisweb flag

gbaccetta commented 2 years ago

I've seen the cors proxy parameter in the sdk but that would not solve my problem with my current architecture. I think that for now I will just disable the preview on the web. I need to figure out how to go around it with firebase hosting and firebase cloud function. If the cloud functions fetch the preview data that should work properly but I need to rewrite the logic you used in your package. I'll let you know. If I achieve that, the code could maybe be shared for people in the same situation as me.

demchenkoalex commented 2 years ago

Thank you @gbaccetta!

DavidOrakpo commented 5 months ago

I've seen the cors proxy parameter in the sdk but that would not solve my problem with my current architecture. I think that for now I will just disable the preview on the web. I need to figure out how to go around it with firebase hosting and firebase cloud function. If the cloud functions fetch the preview data that should work properly but I need to rewrite the logic you used in your package. I'll let you know. If I achieve that, the code could maybe be shared for people in the same situation as me.

Did you have any luck with your work around?