Choose a way to do this check
Private browser session
- Open the staging page and a direct file URL without authentication.
- Check status and content, then confirm the allowed route in a fresh authorised session.
Hosting access control
- Use the approved access mechanism for the host, origin and storage route.
- Confirm intended access and cache behaviour separately for authenticated and anonymous visitors.
Read the response
- Paste anonymous response headers without credentials or cookies.
- Check the status and any authentication or redirect header. Make sure the protected body was not returned.
1. List all the ways the content can be reached
Check staging hostnames, preview URLs, static assets, downloadable files and storage endpoints. Protect the content at the layer that actually serves it. Locking the main HTML page does not protect a PDF hosted at a separate public URL. Record each endpoint and the team responsible for it.
For environments with private or sensitive data, use your organisation's approved identity provider, network controls or application authorisation. Avoid copying real customer records into staging where possible. Keep any local diagnostic data inside the approved environment.
2. Apply access controls before exposing the environment
Basic authentication over HTTPS can be a simple gate for a limited staging site where your policy allows it. Apply it to the existing staging server block, confirm the password file is outside the public root and follow your credential management process. Use TLS because Basic credentials are not independently encrypted.
auth_basic "Staging";
auth_basic_user_file /etc/nginx/staging.htpasswd;Review child locations and any proxy or static-file routes for overrides. Check the origin or storage permissions where relevant so a separate public hostname does not expose the same files. Avoid sharing the password file or putting credentials in build artefacts.
3. Test anonymous and authorised requests
Use a fresh request without cookies or credentials. The staging URL should return the expected denial or redirect to the authorised identity flow. Also request one asset that should be protected. A 200 login form can be appropriate at the login endpoint, but it should never contain the protected content.
host='https://staging.example.com'
for path in / /preview/report.pdf; do
curl -sS -D - -o /dev/null "$host$path" | grep -Ei '^(HTTP/|www-authenticate:|location:)'
doneThen test with an approved account in a fresh browser session. Verify the required pages and files still work. Check that caching does not expose an authorised response to a later anonymous request. Keep production and staging settings separate and test an unaffected public production URL if they share configuration.
4. Deal with anything already visible in search
Protect the material first. If a URL still appears in search, use the relevant search engine's removal tools where appropriate, then track its long-term state separately. Remove accidental public links and sitemap entries. If access controls break legitimate internal testing, restore the previous approved control or narrow the scope without reopening private pages to public requests.
Technical references
Frequently asked questions
Is robots.txt enough for a staging site?
No. It does not stop a browser or other client reading an accessible URL.
Does noindex protect the content itself?
No. It asks supporting search engines to exclude the page from their index.
Where should I put the password file?
Outside the web root, with permissions appropriate for the server and your credential process.
Should I test a staging PDF separately?
Yes. It may be served by a different location, storage endpoint or cache policy.
Written by Richie Aubin
Published
