server.ssr
- Type:
boolean - Default:
false
Enalbe SSR configuration.
Boolean Type
When the value type is boolean, it indicates whether to enable SSR deployment mode. The default is false to disable it.
Object Type
When the value type is Object, the following properties can be configured:
Active Fallback
In a production environment, there are scenarios where it is necessary to actively fallback an SSR project to CSR. Examples include
-
When the SSR fails, a fallback to the CSR is required to ensure product availability.
-
When the SSR is working normally, but there are rendering failures during csr, debugging is required.
-
When the SSR server is under heavy load, it may be necessary to fallback some traffic directly to the CSR to avoid service downtime.
By configuring server.ssr.forceCSR to true in the project, you can control this behavior through query strings or request headers.
For example, in a custom Web Server middleware, you can actively fallback when traffic exceeds a certain threshold: