Home
Support Forums

Is it wise to use a proxy to allow Chrome to directly download a PDF from Google Firebase Storage?

Hello!

So, as far as I’m able to tell, when the download URL for a PDF stored in Google Firebase is used in an <a> tag that has the [download] attribute, Chrome will always open that PDF in a new tab instead of prompting the user to download it. Now, this isn’t a huge deal but I’d really like to offer Chrome users the option to download it directly.

I’ve found that I can use Netlify’s rewrite feature to make a proxy to allow this, like so:

/:folder/:uid/:filename+query https://firebasestorage.googleapis.com/v0/b/[firebase subdomain].appspot.com/o/:folder%2F:uid%2F:filename+query 200

I could only get this to work by having the Firebase query string be combined with the filename within the same placholder, :filename+query, as having a ? in the second half of the rewrite led to that part being disregarded. But this seems to work just fine.

But it kinda feels like a bit of a hack, and I’m wondering how wise it is to do this, so I figured I’d reach out and see if anyone had an opinion on it.

Thanks, y’all!

John