AWS, SPA and SEO
Jerome Kelly

AWS, SPA and SEO

How to optimize the SEO of a SPA hosted on AWS

Nowadays, the use cases for a Single Page Application (SPA) are becoming increasingly rare. Most modern meta-frameworks offer hybrid solutions that combine Server-Side Rendering (SSR), Static Site Generation (SSG), and hydration to leverage the advantages of each approach.

That being said, there are still certain situations where an SPA is necessary, as well as older projects that now require better SEO optimization. While modern search engine crawlers can execute JavaScript on a page, the reality is that achieving a high ranking with an SPA remains more challenging.

Beyond general recommendations, such as improving loading speed or setting up a JavaScript budget, we will introduce two concrete solutions to optimize the SEO performance of an SPA.

⚠️ Keep in mind that these techniques should only be used as a last resort, as they increase infrastructure complexity and make maintenance more difficult.


Cloud Computing Architecture

Although AWS has recently attempted to promote the use of Amplify for hosting static content, the historically most optimal solution for hosting an SPA remains the combination of CloudFront and S3.

Since an SPA consists solely of static files, deploying it does not require a web server (e.g., NGINX) or a dedicated backend (e.g., Node.js). This approach enables low-cost hosting while providing high scalability in case of traffic spikes.

Responsive Image

The key steps for loading an SPA are summarized in the diagram above. Note that:

  • Requests to S3 are, in most cases, unnecessary thanks to CloudFront caching.
  • The JavaScript ⚙️ section is highly simplified. In reality, it includes network requests to fetch JavaScript files, their interpretation by the web browser, and their execution. This step is typically responsible for most performance issues related to SPAs.


Metadata Injection

Let’s start with a very simple use case: an SPA that displays different movies based on their unique identifier, like in this example.

Unsurprisingly, CloudFront’s initial response is an almost empty HTML file.

Responsive Image

Now, let’s assume that this web page is highly optimized in terms of performance and that the JavaScript budget allocated by Google and other search engine bots is sufficient for proper indexing.

However, there remains a significant issue: the absence of metadata! When the page is shared across various platforms (Slack, Messenger, LinkedIn, etc.), no content preview is available.

To address this problem, we will use a Lambda@Edge function to intercept requests between CloudFront and S3 and inject the metadata ourselves!

Responsive Image

Although this approach may seem intimidating, it is actually simple to implement. In just a few hours of work, the public pages of your SPA will display a preview!

From a coding perspective, no more than a hundred lines are needed.

In terms of performance, while it is true that this approach has a slight negative impact, it is minimal and only occurs when the result is not cached!

Responsive Image

Responsive Image


Dynamic Rendering

This approach involves serving different content to humans and bots. While humans will interact with the original version of the SPA, bots will receive a pre-rendered version of the page.

As mentioned at the beginning of this article and in Google’s documentation, this approach should only be used as a last resort!

Set up the rendering engine

The first step is to set up a tool capable of generating fully rendered versions of the different pages. Two possible solutions are:

  • Prerender.io: A commercial product specialized in optimizing SPAs.
  • Rendertron: An open-source solution created by Google for SPA optimization. Note that while the project is no longer actively maintained, its core logic remains relatively simple and easy to adopt. Additionally, Docker images for the project are available, making it easy to set up your own Rendertron instance in just a few minutes.

Bot detection

The next step is to detect bots and redirect them to the pre-rendering engine. Since we are in the AWS ecosystem, we will use a CloudFront Function (a product similar to Lambda@Edge, though explaining their differences is beyond the scope of this article).

Responsive Image

Cache Rule

Adding the x-bot header is crucial because CloudFront uses it as a cache key. This allows CloudFront to cache two different versions of the same page based on the type of user (human or bot).

Responsive Image

Full solution

Responsive Image

Human display 👨‍💼

Responsive Image

Bot display 🤖

Responsive Image


Conclusion

We have presented two different techniques to optimize the SEO performance of an SPA hosted in the AWS ecosystem. As mentioned multiple times, these techniques should only be used as a last resort!

That being said, these approaches are quick and relatively inexpensive to implement. They can sometimes serve as a lifeline for older projects that require SEO improvements or even for recent projects with more specific technical constraints!


share this article

Other articles

Mar 17, 2025

Why Apple Hates PWA

PWAs have made progress, but in my humble opinion, most of them offer an experience inferior to their native counterparts.

Feb 18, 2025

Boost Customer Loyalty: The Power of a Mobile App

Boost customer loyalty and engagement with KPI-focused mobile app strategies, driving measurable results and maximizing ROI.

Feb 13, 2025

Aligning SSO with Business Models

It’s essential to align your business model with the cost structure of the SSO provider. Otherwise, the success of your product could quickly become a financial burden!

Jan 30, 2025

Game Day

It’s crucial to remember that the primary goal is to uncover the blind spots in the project.

Jan 14, 2025

Modern Password Management

At Thirdbridge, providing peace of mind to our clients is at the heart of our priorities, and we believe it all starts with the reliability of our internal practices and processes.

Oct 29, 2024

AI driving innovation: A new Era for Mobile Apps and User Experience

Artificial intelligence (AI) represents a digital transformation that impacts us all. This rapidly advancing technology, fueled by data analysis, not only enables informed decision-making and reliable forecasting but also allows for the completion of many tasks at a faster pace.

Oct 17, 2024

How to Gauge your Mobile App's performance?

A mobile application is the extension of a brand's customer experience.

Oct 15, 2024

Pierre-Étienne Bousquet guest of "Les Affaires"

Our president and co-founder, Pierre-Étienne Bousquet, discussed with Jean-François Venne from Les Affaires the significant growth of digital technology in the retail industry and its impact on online sales, which are becoming increasingly crucial for revenue.

Sep 24, 2024

Cybersecurity and Mobile Applications: Choosing the Right Authentication Method

Mobile applications are essential tools that handle personal data, access sensitive information, and are part of our daily lives. However, in an age where the term cybersecurity is on everyone's lips, ensuring the security of these applications and the information they contain is crucial.

Sep 4, 2024

The impact of UX research

Integrating user experience (UX) principles and practices into the software or application development process has become crucial.

Jul 15, 2024

The Phygital: Rethinking the Retail

Businesses have always had to innovate and rethink their approaches to remain relevant, and this is even more true in the digital age.

Jun 18, 2024

Hybrid vs. Native: Making the Right Choice

At Thirdbridge, the preferred development approach is hybrid. But let's delve deeper by comparing hybrid and native development across key stages of application development: costs, performance, security, and maintenance.

Jun 14, 2024

Funding Your Digital Project

It's no secret that realizing your wildest dreams regarding digital innovation within your company brings many benefits.

Jun 13, 2024

Launching Your Application: The Key to a Well-Planned Budget

Very few digital projects end within their initial budgets and timelines.

May 23, 2024

Tips and Tricks for Sustainable Software Design

When we think about reducing our ecological footprint, our first instinct is to consider the means of transportation we use or our recycling and consumption habits.

May 17, 2024

Maximizing Your App's Profitability: Our Advice

Whether you're looking to save time for your users, retain them, or enhance their shopping experience, we're sharing here the three key elements to consider to maximize your return on investment (ROI).

May 6, 2024

Couche-Tard Connecté: The Cashierless Convenience Store

Congratulations to our mobile development team, who gave their all in recent weeks to ensure a smooth launch of the Couche-Tard Connecté project.

Apr 25, 2024

Beyond Launch: Ensuring the Longevity of Your Application

You've diligently followed the development stages of your application and are about to launch it: congratulations! But even though this is a great accomplishment, your job is far from over...

Mar 22, 2024

Our 12 tips for succeeding in a software project after 12 years in the industry

Thirdbridge celebrates its 12th anniversary!

Feb 25, 2025

Strategic Workshops: A Tailored Approach to Your Project Needs

Strategic workshops are at the core of our collaborative process, enabling us to co-create relevant and innovative solutions for our clients and their customers.

Feb 18, 2025

Proximity Technologies

Presentation of various technologies enabling mobile applications to interact with the physical world.

Feb 10, 2025

User Interviews: A Key but Often Overlooked Step

A great idea doesn’t always guarantee success. Before making any decisions, it's essential to consider the actual needs and expectations of end users.

Jan 20, 2025

Thirdbridge in the spotlight: L'Arrière-Scène's digital partner

Thirdbridge is proud to announce that it is the official digital partner of JA Hypothèques and their latest project: L'Arrière-scène.

Jan 6, 2025

25 Key Trends to Optimize Your Mobile App in 2025

The Thirdbridge team has compiled this article outlining 25 trends to consider for mobile app development or strategy, or any other type of digital product in 2025.

Oct 24, 2024

Leverage Mobile to Optimize the Online Shopping Experience

The holiday season is a strategic time and a crucial opportunity for businesses to maximize their sales through mobile while enhancing the online shopping experience.

Oct 15, 2024

Enhancing Product Management: Key to Success in Software Development

The distinction between product management and project management is essential for ensuring optimal productivity. It’s not enough to treat them as interchangeable concepts; it’s crucial to adopt a proactive approach to place the right resources in the right places.

Sep 27, 2024

Thirdbridge in La Presse: Vision and Growth

Our President and Co-Founder, Pierre-Étienne Bousquet, was recently the guest of Camille Dauphinais-Pelletier of La Presse, where he shared his thoughts on Thirdbridge's journey.

Sep 12, 2024

Maximizing Engagement with User-Generated Content

The emergence of user-generated content (UGC) is revolutionizing co-creation. As a key tool in brands' marketing strategies, UGC is changing the way content is created and consumed.

Aug 9, 2024

PWAs: Test the Potential of Mobile Apps

With the advent of mobile applications, our daily lives have been transformed: these simple tools have become essential facilitators of daily tasks and catalysts for professional and personal interactions.

Jun 26, 2024

Thirdbridge in La Presse

As a business leader, one must ask themselves, "What am I trying to accomplish with my project?" and answer with a vision that extends beyond one's own interests.

Jun 14, 2024

Recruiting an In-House Team or Hiring an Agency for Developing Your Application?

When embarking on a project as significant and important as developing an application, a crucial dilemma quickly arises: choosing between a specialized agency or recruiting your own in-house team to accomplish the work. One thing is certain, both options present distinct advantages and constraints.

Jun 14, 2024

Mastering App Development: A 5-Step Guide to Success

Developing an application isn't something you can just wing. To succeed in this coveted domain, being well-prepared is essential. Unfortunately, a vast majority of large-scale digital projects fail due to inadequate preparation.

May 30, 2024

Do You Really Need an Application?

Don't furrow your brows! This is a genuinely good question. Just observe people on the subway, for example, or in a waiting room: almost everyone has a phone in hand, whether to read, text, play, get information, meet a soulmate, order food, or shop...

May 22, 2024

Optimizing Synergy with Your Software Development Partner

The digital realm, especially that of custom digital solution development, is constantly evolving—between fast technological advancements and changing consumer needs, it's quite challenging to predict what the future holds for web players.

May 14, 2024

Succeeding in Your Updates in 5 Steps

Did you know that at least 20% of the development time of an application should be allocated to testing and quality assurance?

May 3, 2024

Simplified Infrastructures for Enhanced Agility

At Thirdbridge, we believe that project-oriented teams deliver superior quality results, and do so more quickly. Given that they are responsible for the entire value creation flow, these teams can increase their velocity by eliminating bottlenecks themselves. Moreover, entrusting end-to-end flow responsibility to our developer teams makes their work even more engaging and motivating.

Apr 12, 2024

The Thirdbridge Entrepreneurial Scholarship

Thirdbridge is more than proud to be able to support a project and individuals full of promise.