Dan
Dan
3 min read

Content/Origin Mounting - Feature in focus

Sometimes features might seem at first glance to be cool but not very useful. But upon closer inspection they solve countless use cases. Today I'm going to cover one such feature, content mounting. This feature has been available in Peakhour for some time and has solved some unique challenges for our biggest clients, we've applied it to solve SEO, usability, performance, and security problems, just to name a few! The feature, as available in Peakhour, is also unique in the CDN world.

What is Content Mounting?

Peakhour's 'Content Mounting' allows you to 'mount' content hosted on another website or server onto a subfolder of your main website. For example, say you have the primary hostname of:

example.com

This feature effectively means that you can serve content from:

shop.example.com

under your primary hostname, eg

example.com/shop/.

Fetching content from a different origin is configured using Edgerules, giving you extreme flexibility in how content is fetched and for whom. EdgeRules allow you to:

  • Match criteria other than just the url, for example a cookie value, a header, the device type, and more!
  • Override the hostname header, eg the incoming request for example.com will have the host header to the origin replaced with shop.example.com, this is crucial for the secondary origin server to respond to the request. This will also override the Server Name Indication (SNI) for the request to the origin.
  • Rewrite the path, eg the request for /shop/ can be rewritten to be just / so it matches the url scheme on the secondary origin.
  • Rewrite links in the returned HTML document. This is the clincher, content on shop.example.com will have resources/links referencing shop.example.com, these need to be rewritten as example.com/shop/ so navigation stays on example.com and so css/js/images load properly. The only restriction is that only links in html will be rewritten, if there are links in Javascript, or css, then they won't get rewritten and content might not look right.

Use Cases for Content Mounting

  1. Boost domain authority: By 'mounting' all your content onto your main domain, you significantly increase the amount of quality content under your primary URL. This aggregation can amplify your website's domain authority, a key factor search engines consider when ranking your site.
  2. Improved User Experience: This strategy also improves the user experience by keeping everything under one main domain. It reduces confusion, provides consistency and ensures seamless navigation, which are essential elements of a positive user experience. Search engines prioritize websites that offer a great user experience, so this could indirectly improve your rankings.
  3. Improve Performance: Each hostname that the browser has to connect to incurs a performance cost. It has to start a new thread and negotiate a DNS lookup and TLS handshake. You can speed things along with browser hints like dns-prefetch and pre-connect but it can still be in the region of 100-500ms per hostname. Mounting them onto your main domain and allowing Peakhour to maintain warm connections to the different hosts can impart measurable benefits.
  4. API Security: With the rise of Headless eCommerce and micro services, it is common for information to be fetched from several different host names. By mounting them on your main domain, say under /api/ you can achieve versioning and consistency.
  5. Eliminate CORS configuration issues and preflight requests: When javascript in your browser has to call to another host name it has to have specific headers present granting it permission, there is also a penalty with a pre-flight requests. Trendspek eliminated CORS and preflight requests from their application using our content mounting and dramatically improved 3D model loading.

Conclusion

Content mounting is an incredibly powerful tool for organising and orchestrating your website content. With the rise of micro services and headless ecommerce it can be vital for ensuring a consistent and secure website experience.

© PEAKHOUR.IO PTY LTD 2024   ABN 76 619 930 826    All rights reserved.