Skip to content

staticFunctionMiddleware does not respect basePath configuration #6152

@schiller-manuel

Description

@schiller-manuel

Discussed in #6146

Originally posted by busy-dog December 19, 2025

Description of the Issue

staticFunctionMiddleware defaults to mounting __tsr/staticServerFnCache at the root path /__tsr/...
Even if base or basePath is set in SSR or Router configuration, the URLs generated by the middleware still access from the root path, leading to 404 errors when accessing resources.

Reproduction Steps

Configure vite.config.ts, set base: '/docs/', and deploy to Ng with corresponding resource routing configured.
Open the browser and navigate to any route. The chromedevtools network shows /__tsr/staticServerFnCache/xxx.json 404.

Expected behavior
The actual request should be to /docs/__tsr/staticServerFnCache/xxx.json

Possible Solution

Add a parameter to the getStaticCacheUrl method in the staticFunctionMiddleware.ts file of start-static-server-functions, or try reading the basePath to correct the fetch url

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