Skip to content

No config or fetch resource option for server function on client to proxy to server function on server. #3411

Description

@rsdlt

Which project does this relate to?

Start

Describe the bug

Today it's not possible to define the server information (host, port, etc.) or a fetch resource, for server functions on the client to proxy the request to the server function on the server for execution.

When the client is served isolated from the server environment, for example client served on WebView on iOS via CapacitorJS, the server function on the client cannot be configured to define where the server, with its counterpart server function, is located in order to proxy it.

Your Example Website or App

https://stackblitz.com/github/tanstack/router/tree/main/examples/react/quickstart-file-based?file=src%2Froutes%2F__root.tsx

Steps to Reproduce the Bug or Issue

  1. Create an isomorphic server function.
  2. Build the client and server code.
  3. Serve the client via CapacitorJs or similar, isolated from the Nitro server (WebView on iOS or Android)
  4. Deploy the server on its own IP, isolated from the client.
  5. Server function executed on the client cannot be configured to proxy its counterpart on the server.

Expected behavior

As a user I'd expect to be able to define or configure the resource to fetch when the server function on the client proxy the server function on the server.

This resource can be one expected by standard Fetch API:

  • a string containing the URL
  • an object, such an instance of URL, which has a stringifier that produces a string containing the URL
  • a Request instance

Or the server information (host / port) could be define via configuration, so that it applies to all server functions.

Screenshots or Videos

Image

In this diagram, because the client app is served via CapacitorJS on an iOS device, the server function on the client cannot be configured on how to reach its counterpart on the server because it does not have the IP / Host or fetch resource information.

Platform

  • OS: iOS, Android, WebView

Additional context

I believe having this would make the use of isomorphic server functions much more convenient when developing hybrid mobile applications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststartEverything about TanStack Start

    Fields

    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions