A file like this one: https://storage.cloud.google.com/gadr_images/avatar/perja.jpg gets redirected, and because android image elements do not work with redirected urls, i want to prevent that. How can that be done?
2 Answers
Found a solution: If u access a an image or other file via: https://storage.googleapis.com/gadr_images/avatar/perja.jpg instead u w ill not be redirected. I'm not sure if this is an official way to access data, but it works, without redirects.
A way to do it is to keep the request that the URL gives you with HTTPS so the redirect stays on the same protocol.
If not you can try using Picasso 2 OkHttp 3 Downloader that may fix the problem if the HTTPS redirection on the same protocol does not work.
-
thanks, but not sure what u mean with "keep the reqest..". the original url and the redirected one are both https. I am primarily looking for some setting in google storage so that urls do not redirect.– Per MalmDec 30, 2019 at 13:59
-
By keep the request I meant that to try to enforce it to stay on HTTPS so it would not change from HTTPS to http which would trigger a redirect. Regarding a setting in Google Storage so the urls do not redirect, there is no setting like this. A thing you can do is to do CNAME Redirects if you have your own domain since this will go through without adding the redirect since it will go through your own domain. Dec 30, 2019 at 14:18