Some features look niche until you map them to the problems they remove. Content mounting is one of those features. It has been available in Peakhour for some time and has helped solve some unique challenges for our biggest clients. We've applied it to SEO, usability, performance, and security problems. Peakhour's implementation is also unique in the CDN world.
What is Content Mounting?
Peakhour's 'Content Mounting' lets you '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 a high degree of control over how content is fetched and for whom. EdgeRules allow you to:
- Match criteria beyond 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. It also overrides 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. Content on shop.example.com will have resources/links referencing shop.example.com. Those links need to be rewritten as example.com/shop/ so navigation stays on example.com and CSS/JS/images load properly. The restriction is that only links in HTML will be rewritten. Links in JavaScript or CSS won't be rewritten, so content might not look right.
Use Cases for Content Mounting
- Boost domain authority: By 'mounting' all your content onto your main domain, you can significantly increase the amount of quality content under your primary URL. This aggregation can improve your website's domain authority, a key factor search engines consider when ranking your site.
- Improved User Experience: This strategy also improves the user experience by keeping everything under one main domain. It reduces confusion, provides consistency, and keeps navigation seamless. Search engines prioritise websites that offer a strong user experience, so this could indirectly improve your rankings.
- 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 deliver measurable benefits.
- API Security: With the rise of Headless eCommerce and microservices, it is common for information to be fetched from several different hostnames. By mounting them on your main domain, say under /api/, you can achieve versioning and consistency.
- Eliminate CORS configuration issues and preflight requests: When JavaScript in your browser has to call another hostname, it needs specific headers that grant permission, and there is also a preflight request penalty. Trendspek eliminated CORS and preflight requests from their application using our content mounting and dramatically improved 3D model loading.
Conclusion
Content mounting is a practical tool for organising and orchestrating your website content. With the rise of microservices and headless ecommerce, it can be vital for ensuring a consistent and secure website experience.