add support for external image proxying
tripodsan opened this issue · 2 comments
tripodsan commented
This issue is about implementing the external image support explained in adobe/helix-pages#93 for details.
Suggestion
- helix-static receives a path that matches
/${base64_encoded}.external.image
helix-static
detects the external image request and decodes the url- rejects requests with missing or invalid
accept
headers (404
or415
) helix-static
fetches the external content.- if the content-length of the response is
< MAX_BYTES
the content is returned accordingly. - otherwise the
sha1
of the content is computed - it checks if the respective blob is already available
- otherwise it uploads it to azure
- sends a 307 redirect to the azure blob location.
notes
- downloading can happen to memory until a certain threshold is reached but then would go to disk
- if the external url is already a helix blob store url, don't refetch the content
trieloff commented
downloading can happen to memory until a certain threshold is reached but then would go to disk
If this is still interesting, I think with request
we can just pipe the download and upload, so that we never have to hit the disk and keep the memory footprint quite small.
tripodsan commented
I recently discussed this with @davidnuescheler and we probably should not upload external images to our blob store. doing this transparently might cause copyright problems.