|
8 | 8 | // targets should end in `/` to match the site's canonical trailing-slash form |
9 | 9 | // and avoid a second redirect hop. |
10 | 10 | // |
11 | | -// Absolute targets are supported but restricted to a single allowed host, so a |
12 | | -// bad entry can never point traffic at an arbitrary domain. See |
13 | | -// `EXTERNAL_REDIRECT_HOST` below and the matching check in |
14 | | -// `scripts/generate-caddy-redirects.mjs`. Nothing currently uses it: agentOS |
15 | | -// briefly had its own site and is now a vertical here. |
| 11 | +// Absolute targets are supported but restricted to explicitly allowed hosts, |
| 12 | +// so a bad entry can never point traffic at an arbitrary domain. See |
| 13 | +// `EXTERNAL_REDIRECT_HOSTS` below and the matching check in |
| 14 | +// `scripts/generate-caddy-redirects.mjs`. |
16 | 15 | import { readdirSync } from 'node:fs'; |
17 | 16 | import path from 'node:path'; |
18 | 17 | import { fileURLToPath } from 'node:url'; |
19 | 18 |
|
20 | 19 |
|
21 | 20 | const explicitRedirects = { |
| 21 | + // Public community short link. Keep this slashless in authored links, while |
| 22 | + // Caddy serves both variants so copied URLs cannot fall through to a 404. |
| 23 | + '/discord': 'https://discord.gg/rivet-developer-network-822914074136018994', |
22 | 24 | // Integrations moved out of the documentation URL hierarchy. |
23 | 25 | '/docs/integrations/vercel-workflow': '/actors/integrations/workflow-sdk/', |
24 | 26 | '/integrations/vercel-workflow': '/actors/integrations/workflow-sdk/', |
@@ -249,10 +251,10 @@ function legacyDocsRedirects() { |
249 | 251 | export const redirects = { ...legacyDocsRedirects(), ...explicitRedirects }; |
250 | 252 |
|
251 | 253 |
|
252 | | -// External host that wildcard and absolute-URL redirect targets are restricted |
| 254 | +// External hosts that wildcard and absolute-URL redirect targets are restricted |
253 | 255 | // to. Used by both the Astro config and the Caddy generator so neither consumer |
254 | 256 | // can accidentally emit a redirect to an arbitrary host. |
255 | | -export const EXTERNAL_REDIRECT_HOST = 'agentos-sdk.dev'; |
| 257 | +export const EXTERNAL_REDIRECT_HOSTS = ['agentos-sdk.dev', 'discord.gg']; |
256 | 258 |
|
257 | 259 | // Wildcard (prefix) redirects. Any request under `from` (at any depth) is sent |
258 | 260 | // to `to`. |
|
0 commit comments