Skip to content

chore(vercel): move the /docs redirects and headers from nginx - #4932

Merged
thetaPC merged 1 commit into
mainfrom
docs-nginx-redirects
Dec 3, 2026
Merged

thetaPC merged 1 commit into
mainfrom
docs-nginx-redirects

Conversation

@thetaPC

@thetaPC thetaPC commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Vercel challenges docs visitors because every request reaches it through our nginx proxy, from a few IPs. The fix is to have Cloudflare send /docs straight to Vercel, but nginx also holds the /docs redirects and security headers. This moves them here first, so the switch changes nothing for visitors.

  • Adds 555 redirects from nginx: its 734 exact rules, with each trailing slash pair as one {/}? entry, and its 12 pattern rules
  • Puts them before the existing redirects, since nginx runs first today. After them, 10 /docs/developer-resources/* paths would go to ionic.io/resources instead of the v3 docs
  • Adds the Content-Security-Policy headers nginx sets on /docs
  • Leaves /docs/v1 to /docs/v6 and their redirects on nginx
  • Leaves out nginx's X-Robots-Tag, which depends on the host Cloudflare sends, so it belongs to the switch itself

The source is ionic-team/ionic-nginx (internal) at 2fb25cfff:

  • config/redirects.conf: the redirects, every /docs rule except those under /docs/v1 to /docs/v6
  • config/templates/default.conf.template: the CSP headers, and the /docs/v1 to /docs/v6 locations that stay on nginx

Nothing changes while nginx is in front: its rules match first, and the duplicate CSP headers are identical. I compared nginx plus the current vercel.json against the new one for 2,475 paths (every redirect source with and without the slash, plus every built page), and all resolve the same. Requesting all of them from the preview gave the same result: 0 mismatches.

How to test

On the preview:

Path Redirects to
/docs/ /docs
/docs/angular/config/ /docs/developing/config
/docs/2.0.0-beta.1/api /docs/v3/2.0.0/api
/docs/enterprise/barcode https://ionic.io/docs/premier-plugins/barcode
/docs/developer-resources/forms /docs/v3/developer-resources/forms
/docs/v7/api/button /docs/api/button (temporary)

curl -sI <preview>/docs | grep -i content-security prints the three CSP headers.

@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Dec 3, 2026 12:18am UTC

Request Review

@thetaPC
thetaPC marked this pull request as ready for review December 3, 2026 00:36
@thetaPC
thetaPC requested a review from a team as a code owner December 3, 2026 00:36
@thetaPC
thetaPC requested a review from brandyscarney December 3, 2026 00:36
@thetaPC
thetaPC merged commit 1f23e85 into main Dec 3, 2026
7 checks passed
@thetaPC
thetaPC deleted the docs-nginx-redirects branch December 3, 2026 00:39

This branch was successfully deployed

1 active deployment
Preview — cc98c6b6 Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants