Skip to content

infinite redirect with baseUrl + nested tRPC procedure #3990

Closed

Description

@grantnunneley

Environment

nitro: latest
node: 24

Reproduction

https://stackblitz.com/edit/nitrojs-starter-jczkd8ob?file=vite.config.ts

You'll see the infinite redirect happen when clicking the increment button.

Describe the bug

When configuring nitro/vite to serve from a baseUrl and a call is made to a nested tRPC proc an infinite redirect happens.

Nested tRPC procs craft a url with a . in it, e.g. /trpc/nestedProc.get. I think when the url contains this character, the code introduced in #3817 is hit making nitro think the request is for a static asset. This only seems to happen when baseURL is configured however.

A workaround we've found is to prefix the nested procedure with a character (_ works) that breaks the regex above:

export const router = createTRPCRouter({
  nestedProc: {
    _get: get,
  },
});

Additional context

No response

Logs

Activity

  1. pi0 commented on Sep 3, 2026

    @pi0
    Member

    Should be fixed on mai n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions