Commit 7b938f7
fix(platform): install analog-owned SSR renderer to bypass Nitro auto-template
Nitro's resolveRendererOptions (nitro/dist/_chunks/nitro.mjs:296-311)
auto-detects index.html and installs renderer-template[.dev] as
renderer.handler. nitro/vite's configResolved branch that would
swap in its SSR-dispatch renderer only runs when both renderer.handler
and renderer.template are empty (nitro/dist/vite.mjs:574), which never
holds for a typical app with an index.html at root. Result: every
HTML request returns the raw template instead of routing through the
SSR service.
analogNitroPlugin now registers an explicit #analog/ssr-renderer
virtual in nitro.options.virtual and sets renderer.handler to it.
The handler short-circuits to the raw template when
x-analog-no-ssr is on the response (set by injectAnalogRouteRuleHeaders
from routeRules with ssr: false) and otherwise dispatches through
fetchViteEnv to the SSR service env.
The SSR-wrapper service entry keeps its own response shape; the
no-ssr request-header check stays in place as a defense-in-depth path.
Refs #2035
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4b7761c commit 7b938f7
1 file changed
Lines changed: 46 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
215 | 230 | | |
216 | 231 | | |
217 | 232 | | |
| |||
231 | 246 | | |
232 | 247 | | |
233 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
234 | 277 | | |
235 | 278 | | |
236 | | - | |
237 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
238 | 282 | | |
239 | 283 | | |
240 | 284 | | |
| |||
0 commit comments