# Permanent versioning

Permanent versioning enables Marfeel's Preview Branch feature by storing different versions of your site at a protected location known as the M-Store.

At runtime, Marfeel replaces the URLs of your app's static resources with its location in the M-Store Git repository. For instance, replacing a.com/statics/logo.png with a.com/mstore/c362411/c08d3812c07725f3dc062/logo.png.

The actual format of the URL is: /mstore/{mghash}/{filehash}/{filename}.{extension} where:

  • mghash: The first 7 characters of the Media Group alias hashed using SHA-1 algorithm (MediaGroup alias is the same as the Media Group name in most cases).
  • filehash: Hash of the original file using Git's hashing algorithm (opens new window). This is the SHA-1 hash — a checksum of the content you’re storing plus a header.
  • filename: The original file name in plain text.
  • extension: File extension. This is needed so Marfeel's backend and Nginx are able to resolve the file content type.

The substitution logic that converts the original resource location into the "uglified" location (e.g. c362411/c08d3812c07725f3dc062/logo.png) is done through custom JSP Dali tags, as show below:

<c:set var="logoResourcePath">
   <dali:resourceURL path="${resourcesPath}/logo.png" />
</c:set>

Marfeel's Dali JSP tags would resolve the above logo.png resource location into something like: https://live.mrf.io/mstore/c362411/c08d3812c07725f3dc062acb9c5c5ffdc99791eb/logo.png (opens new window)

Permanent versioning can also be thought of as long-term caching of static resources. In other words, using the browser's caching mechanism to store web static resources for as long as its filehash remains the same. Keeping unmodified files cached for a longer period of time.