One Front Door, Two Systems: Secure Modernisation of a Legacy PHP Application, Route by Route

Solution Architect

26 Nov 20267 min read

One Front Door, Two Systems: Secure Modernisation of a Legacy PHP Application, Route by Route

A routing layer in front of Legacy PHP lets you move one page at a time and send traffic back if it fails. How one front door enables secure modernisation.

Every web application already has a front door. It's the address your customers type, the links in your emails and the pages search engines know about. In most Legacy PHP systems, that door leads straight into one application, with nothing in between, and that shapes how much risk any secure modernisation plan has to carry.

That is why modernisation so often feels all-or-nothing: if every request goes straight to the old system, the only way to change who answers is to swap the whole system at once, exposing every customer to every untested change on the same day. Add one small piece of infrastructure between your visitors and the application, and the question changes from "when do we switch everything over?" to "which page do we move next, and how do we move it back if we need to?"

The decision you're facing

The piece of infrastructure is a routing layer. Engineers also call it a reverse proxy, a gateway or a façade. In plain terms, it's a receptionist. Every visitor arrives at the same desk, and the receptionist looks at where they want to go and sends them to the right office. The visitor never sees the corridors behind the desk.

In a migration, the two offices are your existing PHP application and the new system being built alongside it. AWS Prescriptive Guidance describes the starting point simply: once the routing layer is in place, "the proxy routes all traffic to the monolithic application". Nothing changes for users on day one. Then, as features are rebuilt, the layer starts sending specific requests to the new system, based on the web address being asked for. Microsoft's Azure Architecture Center sums up the effect: "Customers continue to use the same interface and are unaware that a migration is in progress."

This is the core of what Martin Fowler calls the strangler fig approach. The harder decisions sit at the front door itself: who controls it, which routes move first, and how you know a move has worked.

What goes wrong when it's done carelessly

A routing layer lowers risk only if it's treated as a serious part of the system. These are realistic ways it can go wrong. They are potential outcomes, not documented incidents.

  • The front door becomes the weak point.Every request now passes through it. AWS warns that this layer "can become a single point of failure or a performance bottleneck", and Microsoft lists the same two risks. If the routing layer goes down, the old and new systems both become unreachable at once.
  • The routing rules drift away from reality. Microsoft advises: "Make sure that the façade keeps up with the migration." Otherwise a checkout page might move while its confirmation step still lives in PHP.
  • The first route is the wrong route. Teams often start with the most visible or most painful feature. If that feature is tangled up with sign-in, payments and half the database, the first move becomes a large, risky project in disguise.
  • Nobody can tell whether the move worked. Without a before-and-after measure, "it seems fine" becomes the only test.
  • The way back is removed too early. If the old PHP version of a page is deleted the day the new one goes live, the routing layer can no longer send traffic back, and the safety net is gone.

The approach doesn't suit everything. Microsoft notes it may not fit where "requests to the back-end system can't be intercepted", or small systems that are simple to replace whole.

The defensive approach: a front door built for secure modernisation

At the level of concepts, a defensive front door has four parts.

1. Put the door in first, and change nothing else. The first release adds the routing layer and sends everything to the existing PHP application. That proves the layer can carry real traffic and gives a baseline for speed and errors. Because AWS and Microsoft both flag the single-point-of-failure risk, the layer itself needs the same care as your main system: more than one instance, monitoring and a clear owner.

2. Choose what moves first by route, not by ambition. Every page and feature in a web application sits behind a web address, which makes routes a natural unit of work. Good first candidates tend to be:

  • Self-contained: few links to other parts of the system and little shared data.
  • Low in business risk: a status page, a help centre or a reporting screen, rather than payments.
  • Easy to compare: you can check that the old and new versions give the same answers.
  • Useful: something that earns its keep once moved. Microsoft notes the approach lets you "perform high-ROI replacements before low-ROI replacements".

Features that depend on shared sign-in or heavy database writes usually move later. AWS and Microsoft both flag shared data as a hard part of running two systems side by side.

3. Watch each route before and after it moves. The routing layer sees every request, which makes it a good vantage point. For each route that moves, compare the period before and after: error rates, response times, completed transactions such as orders or form submissions, and support tickets about that page. Agree in advance what "worse" means, so a decision to send traffic back is a rule rather than an argument.

4. Keep the way back open. While the old PHP version of a route still exists and the data behind it is still in step, moving the route back is a change to the routing rules, not an emergency rebuild. Microsoft makes the same point about data in its database example: rollback remains possible while the old structures still exist, and becomes much harder and riskier once they are removed. Retire the old version only after the new one has run cleanly for an agreed period.

Fowler is candid that this temporary scaffolding costs money, but argues that "the reduced risk and earlier value from the gradual approach outweigh its costs". Microsoft frames it the same way: balance the risk-reduction benefits against the temporary infrastructure costs.

Where Node.js fits, and where it doesn't

Node.js can be a good home for the routes that move, and a team can build new features in it while the PHP system keeps running. Depending on the application, it may suit some routes and not others.

The routing layer itself, though, doesn't need to be written in Node.js, and usually shouldn't be custom-built. It's a well-understood piece of infrastructure, and choosing a mature, well-supported option matters more than matching your application language.

A front door doesn't make the new system secure. Each route that moves to Node.js needs its own security testing, dependency management and monitoring. And while both systems run, you are operating two stacks, so your team needs the skills and the time to look after both.

What this means for your organisation

Ask these questions of your own system:

  • Does every important feature sit behind a web address you can route, or does some work happen through scheduled jobs and direct database access that no routing layer will see?
  • Who would own the routing layer, and what happens to your whole site if it fails?
  • Do you know the current error rate and response time for your busiest pages? Without that baseline, you can't judge a move.
  • Which three routes are self-contained, low-risk and worth moving first?
  • For each route, what exactly would trigger sending traffic back, and who can make that call outside office hours?
  • What depends on the old PHP version of a page before it can safely be removed?

Recommended next step

Before anything moves, map your application by route: the main web addresses, what each one does, which data it reads and writes, and how much traffic it carries. That single document tells you whether a front door will work for your system, which routes are good first candidates, and where the hidden dependencies and exposures sit. Our Free Security and Modernisation Review gives you that view of your own application, and the safest route to start from.

Free Security and Modernisation Review

Sketchmonk is a security-led software engineering company. Our engineers have built software for a national defence research lab, global cyber security vendors and security-first product companies, with 16+ years of engineering behind them. In a free Security and Modernisation Review, we look at the application you run today: where it is exposed, what it depends on, and the safest route to a secure, modern platform. Want to see how we have handled problems like yours? Ask for a case study in the same email. There's no obligation to proceed.

Request your free Security and Modernisation Review

Build with us. Deploy with us. Win with us

We don't deliver projects and walk away. We build with you, inside your mission.

Book a strategic consultation