Dev.to WebDev 🛠 Dev 👁 0 📖 5 min read

Serving your blog or docs at /blog through a reverse proxy? A 12-point SEO checklist

Automated technical SEO checks that catch indexing blocks and deploy regressions — seotto.com A common setup: the main site is one app, and the blog (or docs, or help centre) is a different app, often on a hosted platf

Automated technical SEO checks that catch indexing blocks and deploy regressions — seotto.com

A common setup: the main site is one app, and the blog (or docs, or help centre) is a different app, often on a hosted platform, served under the main domain through a reverse proxy. Visitors and crawlers see example.com/blog/my-post. Behind the scenes, the proxy fetches example-blog.hostingplatform.app/my-post.

Teams do this because they want one domain instead of blog.example.com, and whichever side of that argument you're on, the proxy itself has to be configured carefully. The most common failure is the origin's hostname or root-relative paths leaking into places crawlers read: canonical tags, sitemaps, redirects and links. Then search engines see two sites, or a site whose canonical tags point somewhere else entirely.

Here's the checklist.

The proxy

1. Make sure paths map cleanly in both directions

With Nginx, the trailing slashes in location and proxy_pass decide whether the /blog prefix is stripped:

location /blog/ {
    proxy_pass https://example-blog.hostingplatform.app/;   # /blog/post -> /post
    proxy_set_header Host example-blog.hostingplatform.app;
    proxy_set_header X-Forwarded-Host example.com;
    proxy_set_header X-Forwarded-Proto https;
    proxy_ssl_server_name on;
}
location = /blog { return 301 /blog/; }

Test a few URLs with and without trailing slashes, with query strings, and with encoded characters, and confirm each one reaches the right origin path.

2. Rewrite redirects from the origin

If the origin redirects /old-post to /new-post, it sends Location: https://example-blog.hostingplatform.app/new-post (or /new-post). Without rewriting, visitors and crawlers are sent off your domain, or to example.com/new-post without the prefix. In Nginx:

proxy_redirect https://example-blog.hostingplatform.app/ /blog/;
proxy_redirect / /blog/;

Then check with curl -sI https://example.com/blog/old-post that the Location header stays on your domain and keeps the prefix.

3. Handle cookies and caching headers on purpose

Cookies set by the origin may be scoped to its own domain or to /. Decide whether the blog needs cookies at all. Make sure Cache-Control from the origin passes through sensibly, and that your CDN doesn't cache personalised pages from either app under the other's rules.

4. Block the origin hostname from being indexed

The origin is still publicly reachable. If search engines find it, you have a duplicate of your whole blog. Options, in order of preference: restrict the origin to requests from your proxy (an allowlist or a shared secret header), make the origin redirect to the proxied URL for any request that doesn't come from the proxy, or at minimum make its canonical tags point at the proxied URLs.

The app behind the proxy

5. Configure the public base URL in the app

Most blog engines and docs generators have a setting for the site's public URL and base path (site_url, baseURL, basePath, url plus baseUrl). Set it to https://example.com/blog/. This one setting usually fixes canonicals, sitemaps, feeds and Open Graph URLs together.

6. Check the canonical tags

View source on a few proxied pages. The canonical should be https://example.com/blog/my-post, not the origin hostname and not a URL without the prefix. A wrong canonical is the most damaging leak on this list, because it tells search engines the proxied page isn't the real one.

7. Check the sitemap and robots.txt

The blog's sitemap must list proxied URLs, and should be referenced from the main site's robots.txt (the one at example.com/robots.txt; crawlers don't read example.com/blog/robots.txt). If the origin serves its own robots.txt, it only applies to the origin hostname.

A reverse-proxy docs move can hide indexing problems until traffic drops. seotto.com checks for canonical, robots and indexing issues after the cutover.

The HTML

8. Find root-relative links and assets

A link like href="/tags/nginx" or src="/assets/app.js" in the blog's HTML resolves to example.com/tags/nginx, which is the main site, not the blog. Some engines handle this through the base path setting; hand-written templates often don't. Crawl a sample of proxied pages and list every root-relative URL that doesn't start with /blog/.

9. Be careful with the <base> tag

Some setups fix relative links with <base href="/blog/">. That changes how every relative URL on the page resolves, including fragment links like href="#comments" (which then point to /blog/#comments, not the current page) and scripts that build URLs. If you use it, test fragment links, forms and client-side routing explicitly. Fixing the templates is usually safer.

10. Check structured data and social tags

JSON-LD url, @id, mainEntityOfPage, and image URLs, plus og:url and og:image, are often built from a different config value than the canonical. Check them separately.

A quick leak check script

Most of items 6 to 10 can be checked at once. Fetch a handful of proxied pages and search the HTML for the origin hostname and for root-relative URLs outside the prefix:

for p in / /my-post/ /tags/nginx/; do
  html=$(curl -s "https://example.com/blog$p")
  echo "== $p"
  echo "$html" | grep -o 'hostingplatform\.app[^"]*' | sort -u
  echo "$html" | grep -oE '(href|src)="/[^"]*"' | grep -v '="/blog/' | sort -u | head
done

Any output is a leak worth fixing. Run it again after every upgrade of the blog engine, since template changes are a common way leaks come back.

After launch

11. Crawl both hostnames

Crawl example.com/blog/ and confirm no links lead to the origin hostname or outside the prefix. Then search for the origin hostname in a search engine and in your logs' referrers, to see whether it has been found.

12. Watch Search Console for the new section

Add a URL-prefix property for https://example.com/blog/, or filter the domain property by that path, and watch indexing and the "Alternate page with proper canonical tag" and "Duplicate" statuses for the first few weeks. Leaks in canonicals and redirects show up there quickly.

Leaked hostnames and canonicals pointing at the wrong place are exactly the kind of quiet issues we look for at seotto.com, because the pages look perfect to a human visitor.

Related reading

Have you put a blog or docs site behind a /blog proxy? What leaked: the canonical, the redirects, or the sitemap?

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.