Skip to content

Support remote asset caching in Replays #7007

Closed as not planned
Closed as not planned
@billyvg

Description

@billyvg

Problem Statement

Session Replay handles static assets differently based on the type of asset. They are either inlined into the recording or the source URL is preserved and fetched during playback-time. There are pros and cons to both of these approaches that will be explained below.

Inline

Currently only CSS is inlined in the recordings. The benefits of this are:

  • Preserving the CSS at the time of recording. Viewing the replay will reflect the CSS as the user experienced it regardless of any updates to the CSS since.
  • Viewers of the Replay can still access the stylesheet if the original stylesheet requires authentication.
  • No CSP/CORS concerns
    • Not being able to load fonts can cause rendering differences which affect mouse precision (e.g. the production font is a bit larger than the default system font in replay, which affects the height of elements in the replay -- ultimately causing clicks to look incorrect because the click happens below the target element)

Remote

The benefits of inlining assets are conversely the downsides of remotely fetching the asset. However, the reason to remotely fetch static assets is to reduce the file size of recordings. This affects how much data the recording clients send, as well as the amount of storage required . Generally these assets (fonts, images, etc) do not change often, so replays can contain a lot of redundant data as well.

In our Session Replays, fonts and images are loaded at playback-time and can face cross-origin issues. By default we block images due to privacy concerns, but have had a handful of tickets from users who choose to unblock and not see their images get loaded during playback due to CORS. This leads them to think our product is broken.

Solution Brainstorm

It would require a bit of complexity, but we can have the best of both worlds if we were to proxy requests to all static assets to a version that is saved on a server we control. This means we are not inling anything so recording file sizes should be reduced (which means our customer's customers are sending less data). We should face less CORS issues as we can add our asset server as an allowed origin.

One thing this approach may not be able to handle however is if an asset requires authentication to access.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions