zuplo 6.73.13 → 6.73.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,107 @@
1
+ ---
2
+ title: Server-Side Rendering
3
+ sidebar_icon: server-cog
4
+ description:
5
+ Run the Dev Portal on a server for each deployment so protected routes are
6
+ enforced server-side.
7
+ ---
8
+
9
+ <EnterpriseFeature name="Dev Portal Server-Side Rendering" />
10
+
11
+ By default, the Zuplo-hosted Dev Portal is statically prerendered (SSG). Setting
12
+ `devPortal.serverSideRendering: true` in `zuplo.jsonc` builds and serves the
13
+ portal server-side for each deployment. Zudoku's
14
+ [protected routes](./zudoku/configuration/protected-routes.md) are enforced on
15
+ the server, so protected content leaves the public bundle and unauthenticated
16
+ requests cannot fetch it, as described in
17
+ [Server-side Content Protection](./zudoku/guides/server-side-content-protection.md).
18
+ **SSR applies to preview and production deployments only—never the working
19
+ copy.**
20
+
21
+ ## Prerequisites
22
+
23
+ - The SSR enterprise add-on enabled on the account.
24
+ - The latest version of Zudoku. See [Updating the Dev Portal](./updating.mdx).
25
+ - For protected content,
26
+ [authentication](./zudoku/configuration/authentication.md) configured and
27
+ `protectedRoutes` set in the Zudoku configuration.
28
+ - The standard `zudoku build` build script in `docs/package.json`, which the
29
+ scaffold includes by default. Zuplo appends the SSR build flags automatically.
30
+ A custom build script that doesn't forward CLI arguments produces a static
31
+ build instead.
32
+
33
+ ## Enable SSR
34
+
35
+ Add the `devPortal` object alongside any existing settings in
36
+ [zuplo.jsonc](../programmable-api/zuplo-json.mdx) at the project root:
37
+
38
+ ```jsonc
39
+ {
40
+ "version": 1,
41
+ // Other project settings...
42
+
43
+ // Enable server-side rendering for the Dev Portal.
44
+ "devPortal": {
45
+ "serverSideRendering": true,
46
+ },
47
+ }
48
+ ```
49
+
50
+ No build-script changes are required. SSR takes effect on the next deployment.
51
+
52
+ ### Example: protect partner documentation
53
+
54
+ Suppose partner documentation is available under `/partners/*` and should only
55
+ be available to signed-in users. With authentication already configured, add the
56
+ route pattern to `zudoku.config.ts`:
57
+
58
+ ```typescript title="zudoku.config.ts"
59
+ {
60
+ // ...
61
+ protectedRoutes: ["/partners/*"],
62
+ }
63
+ ```
64
+
65
+ Enable SSR in `zuplo.jsonc` as shown above, then deploy a branch. In the preview
66
+ environment, a signed-out request to `/partners/getting-started` shows the login
67
+ prompt instead of the page content. After signing in, the user can access the
68
+ page.
69
+
70
+ :::note
71
+
72
+ If the account doesn't have the SSR add-on, the deployment fails with an error
73
+ that directs you to contact support or remove the flag.
74
+
75
+ :::
76
+
77
+ ## Test on a preview environment
78
+
79
+ :::caution{title="The working copy always uses static rendering"}
80
+
81
+ SSR takes effect on preview and production deployments only. The working copy
82
+ builds statically regardless of the flag, so protected routes are not enforced
83
+ server-side there.
84
+
85
+ :::
86
+
87
+ Deploy a branch to create a preview environment and validate SSR there. While
88
+ signed out, request a protected route and confirm that the login prompt appears
89
+ instead of the protected content.
90
+
91
+ ## Caching
92
+
93
+ Responses to anonymous visitors are cached at the edge, so public pages stay
94
+ fast. Requests with a Dev Portal authentication session always render on demand
95
+ and are never cached.
96
+
97
+ ## Reverting to static rendering
98
+
99
+ Remove `serverSideRendering` or set it to `false`, then redeploy. The portal
100
+ reverts to static prerendering, and the server infrastructure is torn down
101
+ automatically.
102
+
103
+ ## Next steps
104
+
105
+ - [Configure protected routes](./zudoku/configuration/protected-routes.md)
106
+ - [Protect content server-side](./zudoku/guides/server-side-content-protection.md)
107
+ - [Configure authentication](./zudoku/configuration/authentication.md)
@@ -89,3 +89,23 @@ Only enable this setting if you understand the implications.
89
89
  "allowHostHeaderOverride": true,
90
90
  }
91
91
  ```
92
+
93
+ ## `devPortal`
94
+
95
+ Configure the developer portal with the `devPortal` object. The
96
+ `serverSideRendering` boolean enables server-side rendering for the developer
97
+ portal. When unset or `false`, the portal is statically prerendered. This
98
+ setting requires an enterprise add-on. See
99
+ [Server-Side Rendering](../dev-portal/server-side-rendering.mdx).
100
+
101
+ ```jsonc
102
+ {
103
+ "version": 1,
104
+ // Other project settings...
105
+
106
+ // Enable server-side rendering for the Dev Portal.
107
+ "devPortal": {
108
+ "serverSideRendering": true,
109
+ },
110
+ }
111
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zuplo",
3
- "version": "6.73.13",
3
+ "version": "6.73.15",
4
4
  "type": "module",
5
5
  "description": "The programmable API Gateway",
6
6
  "author": "Zuplo, Inc.",
@@ -19,9 +19,9 @@
19
19
  "zuplo": "zuplo.js"
20
20
  },
21
21
  "dependencies": {
22
- "@zuplo/cli": "6.73.13",
23
- "@zuplo/core": "6.73.13",
24
- "@zuplo/runtime": "6.73.13",
22
+ "@zuplo/cli": "6.73.15",
23
+ "@zuplo/core": "6.73.15",
24
+ "@zuplo/runtime": "6.73.15",
25
25
  "@zuplo/test": "1.4.0"
26
26
  }
27
27
  }