image proxy

From IndieWeb

This article is a stub. You can help the IndieWeb wiki by expanding it with relevant information.


An image proxy is a service that fetches and re-serves images from a new URL, used by IndieWeb sites to provide better performance, fidelity, and/or reliability of images embedded in posts.

Why

Image proxies can help website performance, customize images for their page context, and improve image viewing reliability with the following techniques:

  • resizing, reformatting, cropping, filtering or otherwise modifying images before serving inside a page
  • avoiding mixed content warnings when serving images from other sites
  • caching content that may disappear in the future

IndieWeb Examples

Open Source

Archived:

Brainstorming

Considerations for building an image proxy

capjamesg

capjamesg is experimenting with image layouts in his web reader, Artemis.

When a request is made to the image proxy, Artemis first checks if the user making the request is signed in. This ensures only users can use the proxy.

Next, Artemis checks if the URL the proxy is requesting is in a post in his web reader. If it is, then the request will be made. This prevents users from using the proxy arbitrarily.

Then:

  • A HEAD request is made to check for the Content-Length header.
  • If an image is more than a few MB according to the Content-Length, the request is not fulfilled.
    • TODO: Add a proper timeout mechanism.
  • If an image doesn't have an image Content-Type, the request is not fulfilled.

One direction James wants to explore is whether there is a means by which to prevent a request unless it is made from a particular origin. James hasn't read into this yet.

Refresh rates

An image proxy may download and save assets that it plans to serve many times so the underlying resource does not need to be requested multiple times.

If an asset is downloaded and saved so it can be served through a proxy, it is essential that images are refreshed on some cadence, especially for profile pictures. Refreshing ensures users see up-to-date content.

See Also