Orofold Labs

Launching soon

Notes Get in touch

Operations and security 4 min read Updated

Staging environments that match production

In short

A staging site helps only when it behaves like production, holds no more real customer data than it must and stays out of search results and away from strangers.

A staging environment helps only when the copy resembles production. The Twelve-Factor App, a methodology for building software-as-a-service applications, asks teams to keep development, staging and production as similar as possible. Start with the three gaps it names. Then deal with two risks that small teams often overlook: search engines finding the copy, and strangers reaching it.

Close the three gaps

Dev/prod parity describes three gaps between development and production. The time gap is the delay between writing code and running it in production, which can stretch to days, weeks or months. The personnel gap separates the developers who write code from the people who deploy it. The tools gap appears when development and production run different software stacks.

A staging environment narrows all three. Deploy with the same process you use in production, run the same PHP version and web server settings, and let the same script perform every deploy. The table gives an example of each gap in a small team and a practical step to narrow it.

GapExample in a small teamNarrowing step
TimeChanges wait a week before anyone deploys themDeploy each change to staging on the day it is ready
PersonnelOne person uploads files by hand, and nobody else knows howUse one deploy process that any team member can run
ToolsStaging runs an older PHP version or a different database engineMatch versions and engines, and record any difference you cannot remove

Handle data with care

Copying production data into staging is convenient, and it is often risky. Staging environments usually have looser access control than production, and copies spread to laptops, exports and backups without anyone noticing. If you need realistic data, prefer generated records or data that has been anonymised before it leaves production. Where real data is essential, limit who can reach staging, and delete the copy when the test ends.

Keep staging credentials separate from production ones. A password that opens both turns the test site into a way into the live system. The article Keeping secrets out of your code and logs explains how to separate them.

Working on something similar in your own product? A few honest sentences are enough – we read every enquiry and reply by email. Apply with your idea

Keep search engines out

Google’s guidance on blocking Search indexing with noindex describes two ways to apply the rule: a meta tag in the HTML, or an HTTP response header. The rule works only if Google can crawl the page and read it. A page blocked by robots.txt is never read, so its noindex tag is never seen. The guidance also states that a noindex rule placed in robots.txt is not supported.

The guidance does not mention staging sites, so the points below are general practice rather than a rule from Google. Send the noindex header from the web server, so that every page carries it without editing each template. Do not rely on robots.txt alone to keep the site out of results. For the difference between the two mechanisms, read robots.txt and noindex are different controls.

Control who can reach it

Staging sites often hold unfinished features, test accounts and sometimes copies of real customer records. Put the whole site behind a login, or allow only known IP addresses. HTTP basic authentication is a simple option for a small team, provided it runs over HTTPS and the password is unique to the site.

Check the setup from outside your network. Open the staging address in a private browser window, confirm that it asks for a login, and confirm that the response carries the noindex header. Repeating this check after each change to the server configuration takes minutes, which is small compared with an exposed test site.

A checklist for each staging site

Use this list when you set up a staging site, and again after any change to the server. Once staging matches production, use it to rehearse the steps in releases and rollbacks that you can reverse.

  • The same PHP version, extensions and web server settings as production.
  • The same deploy process as production, which any team member can run.
  • Real customer data removed, or replaced with generated records.
  • Credentials that differ from the production ones.
  • A noindex header on every page, with no reliance on robots.txt alone.
  • Access limited to named people, and checked from outside your network.

Common questions

What causes differences between environments?
The Twelve-Factor App names three gaps: the time gap between writing code and running it in production, the personnel gap between those who write code and those who deploy it, and the tools gap between different software stacks.
Does a noindex rule still work if robots.txt blocks the page?
No. Google must be able to crawl a page to read its noindex rule, so a page blocked by robots.txt never has the rule seen. Google also states that noindex in robots.txt is not supported.
How can a site send a noindex rule?
Google describes two ways: a meta tag in the HTML, and an HTTP response header. Google’s guidance does not cover staging sites specifically, so check the setup from outside your network.

Sources

  1. Dev/prod parity, The Twelve-Factor App. Accessed 24 November 2026
  2. Block Search indexing with 'noindex', Google Search Central. Accessed 24 November 2026

Further reading

Have an idea that should exist? Or a working product that needs more customers, a new website or a complete rework? Bring us anything. Apply with your idea

All notes