Skip to content

index.csr.html causes Vercel to bypass Angular SSR entrypoint for / route #30736

@srcn

Description

@srcn

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When deployed, Vercel detects index.csr.html at the root of the output and serves that file directly, preventing the SSR server from being invoked for /.

Since with rewrites the filesystem check happens before any of the rules applied, it's impossible to trigger SSR server when using rewrites configuration.

I've also tried the index option from the angular.json to change the name of the index.html on output. While that fixes this particular problem, because index.csr.html is hardcoded into the server code, it crashes the server if any of the routes are Client rendered.

Renaming the output files to something like server.html and client.html or ensuring that the index option also updates the file references used internally by the server, would resolve the issue.

Minimal Reproduction

Here's a public repo with a minimal Angular v20 setup: https://github.com/srcn/angular20ssr

It's deployed here: https://angular20ssr.vercel.app/

If you check the source code of the homepage, you will see it's Client rendered even though all server routes are set to Server rendering mode.

If you visit the second route https://angular20ssr.vercel.app/second-route and see the source code, you will see it's correctly rendered using the server.

Exception or Error


Your Environment

Angular CLI: 20.1.1
Node: 22.15.1
Package Manager: npm 11.4.0
OS: darwin arm64

Angular: 20.1.1
... build, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-server, router, ssr

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.1
@angular-devkit/core         20.1.1
@angular-devkit/schematics   20.1.1
@schematics/angular          20.1.1
rxjs                         7.8.2
typescript                   5.8.3

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions