Commit Graph
4 Commits
Author SHA1 Message Date
Jonathan Summers-MuirandClaude Opus 5.5 4da4e91a9b chore(www): make the launch week 16 rewrite readable (#54476)
Same paths as #54475, with the past launch weeks as named lists instead
of one regex.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 22:42:18 +08:00
anthony lio 99e7de69a2 fix(www): forward lw16 editor steps under /launch-week/ticket/create to the card app (#54475)
## Problem

- a refresh or a link to a lw16 card editor step shows the www 404 page,
for example
[/launch-week/ticket/create/select-material](https://supabase.com/launch-week/ticket/create/select-material)
- the lw16 card app opens its editor steps under
`/launch-week/ticket/create/*`
- the rewrite from #54315 keeps `/launch-week/ticket` and its subpaths
on www, but www has a page only at the exact path

## Solution

- forwards the subpaths of `/launch-week/ticket` to the lw16 card app
while the exact path stays on the lw15 ticket page
- adds an editor step path to the security header tests

## Preview links

| Site | Live | Preview |
| ---- |
--------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
| WWW |
[/launch-week/ticket/create/select-material](https://supabase.com/launch-week/ticket/create/select-material)
|
[/launch-week/ticket/create/select-material](https://zone-www-dot-com-git-antlio-fix-lw16-ticket-rewrite-supabase.vercel.app/launch-week/ticket/create/select-material)
|
| WWW | [/launch-week/ticket](https://supabase.com/launch-week/ticket) |
[/launch-week/ticket](https://zone-www-dot-com-git-antlio-fix-lw16-ticket-rewrite-supabase.vercel.app/launch-week/ticket)
|

## Review instructions

1. run `pnpm --filter www exec vitest run lib/security-headers.test.ts`
and make sure that all tests pass
2. open the preview
[/launch-week/ticket/create/select-material](https://zone-www-dot-com-git-antlio-fix-lw16-ticket-rewrite-supabase.vercel.app/launch-week/ticket/create/select-material)
and make sure that the lw16 card app loads, not the www 404 page
3. open the preview
[/launch-week/ticket](https://zone-www-dot-com-git-antlio-fix-lw16-ticket-rewrite-supabase.vercel.app/launch-week/ticket)
and make sure that the lw15 ticket page still loads

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-12-02 16:18:30 +02:00
anthony lio b610d677c5 feat(www): lw16 launch week rewrite (#54315)
## Problem

- supabase.com/launch-week shows the lw15 page, and the lw16 card app
runs as a separate vercel app
- a forward rule for all of `/launch-week/*` also covers the www pages
of past launch weeks, and www does not add its security headers to
forwarded paths

## Solution

- moves the lw15 page to `/launch-week/15`
- adds rewrites that forward `/launch-week` and its other paths to the
lw16 card app at `launch-week-16.vercel.app/launch-week/`
- changes the root rule to target `/launch-week/` directly because www
removes the trailing slash and the app adds it, a loop otherwise
- keeps `/launch-week/7`, `/8`, `/15`, `/ticket` and `/tickets/*` on www
with the www security headers
- adds the launch week paths to the security header tests
- adds `/launch-week` to the paths that the redirect checks leave to
other apps

## Preview links

| Site | Live | Preview | Search for |
| ---- | ---- | ------- | ---------- |
| WWW | [/launch-week](https://supabase.com/launch-week) |
[/launch-week](https://zone-www-dot-com-git-antlio-lw16-launch-week-rewrite-supabase.vercel.app/launch-week)
| Claim your card |
| WWW | [/launch-week/15](https://supabase.com/launch-week/15) |
[/launch-week/15](https://zone-www-dot-com-git-antlio-lw16-launch-week-rewrite-supabase.vercel.app/launch-week/15)
| Launch Week 15 |

## Review instructions

1. run `pnpm --filter www exec vitest run lib/security-headers.test.ts`
and make sure that all tests pass
2. open the preview
[/launch-week](https://zone-www-dot-com-git-antlio-lw16-launch-week-rewrite-supabase.vercel.app/launch-week)
and make sure that the lw16 card page loads with no redirect loop
3. open the preview
[/launch-week/](https://zone-www-dot-com-git-antlio-lw16-launch-week-rewrite-supabase.vercel.app/launch-week/)
and make sure that www redirects it to `/launch-week` once

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-12-01 14:45:55 -06:00
Etienne StalmansandClaude Opus 5.5 08388eecd6 feat: update headers on www (#43442)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## Problem

www sends no `Content-Security-Policy`, `X-Frame-Options`,
`X-Content-Type-Options`, or `Referrer-Policy` headers on its pages.
Only HSTS is set.

The first version of this PR added these headers on `/(.*)`. That turned
out to be unsafe, because www is the zone router: `lib/rewrites.js`
proxies Studio (`/dashboard`), docs, the UI library, the design system,
the knowledge base, and other apps, and the header rules in
`next.config.mjs` also apply to those proxied responses. A CSP there
would add a second enforced policy on top of each app's own headers, and
`X-Frame-Options: DENY` would break the UI library previews, which
iframe `/library/example/*`.

## Solution

The headers are built in `apps/www/lib/security-headers.js` and spread
into `headers()` in `next.config.mjs`.

**Scope**
- The rules apply only to paths that www serves itself. The proxied path
prefixes come from `lib/rewrites.js`, so a new zone rewrite is excluded
automatically.
- On those paths: `X-Frame-Options: SAMEORIGIN`,
`X-Content-Type-Options: nosniff`, `Referrer-Policy:
strict-origin-when-cross-origin`, and an enforced CSP.

**CSP (script-focused)**
- `script-src` allows `'self'`, `'unsafe-inline'`, and an explicit list
of the third-party script hosts that www pages load: GTM through Stape,
PostHog, Usercentrics, tweet embeds, HubSpot, hCaptcha, Default.com, Buy
with AWS, and a path-scoped jsDelivr entry for unicornstudio. Each entry
has a comment that names its user.
- `'unsafe-inline'` stays, because the Next.js inline scripts need a
nonce otherwise, and a nonce needs dynamic rendering.
- `object-src 'none'`, `base-uri 'self'`, `form-action 'self'`,
`frame-ancestors 'self'`.
- Removed from the earlier version: `unpkg.com` (only used inside a blog
code block, and anyone can publish scripts there), `*.vercel.app` (any
Vercel app), `frontend-assets.supabase.com` (www serves its assets from
the same origin), and the duplicate `script-src-elem`.

**`'unsafe-eval'`**
- Off by default.
- Allowed only on the pages that evaluate MDX on the client with
`next-mdx-remote-client`: `/changelog`, `/customers/[slug]`,
`/events/[slug]`, `/alternatives/[slug]`, and
`/partners/catalog/[slug]`. Removing it there would break those pages.
- Allowed in development, because Next.js needs it there.

**Preview and staging**
- Detection matches Studio's CSP: `NEXT_PUBLIC_VERCEL_ENV === 'preview'`
or `NEXT_PUBLIC_ENVIRONMENT` of `local` or `staging`. It no longer
depends on `NEXT_PUBLIC_IS_PLATFORM`.
- On preview and staging, the Vercel toolbar and the staging PostHog
host are added.
- The PostHog origin also comes from `NEXT_PUBLIC_POSTHOG_HOST`, the
same value the client uses.

**Tests**
`lib/security-headers.test.ts` covers the policy for each environment,
the proxied prefixes from the real rewrites, and the header sources. The
sources are compiled with the same path-to-regexp build and options that
Next.js uses.

## Review instructions

1. Open the preview and accept cookie consent so GTM and PostHog load.
2. Open DevTools → Console and filter on `Content-Security-Policy`.
3. Visit these pages and confirm there are no violations:
   - home
- a blog post with a tweet embed (`/blog/launch-week-5-community-day`)
   - `/changelog`
   - a `/customers/...` page
   - `/state-of-startups`
   - `/contact/sales`
   - `/aws-marketplace`
   - a `/go` page with a HubSpot form
4. Run `curl -sI <preview>/` and check the four headers. Run `curl -sI
<preview>/changelog` and check that the CSP includes `'unsafe-eval'`.
5. Run `curl -sI <preview>/dashboard` and `curl -sI <preview>/library`
and check that they have no www CSP or `X-Frame-Options`.
6. Confirm `/dashboard` and `/library` still load.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 11:19:07 +01:00