Skip to main content

Get Requests and Caching

Connect supports performing idempotent, side-effect free requests using an HTTP GET-based protocol. This makes it easier to cache certain kinds of requests in the browser, on your CDN, or in proxies and other middleboxes.

First, configure your server to handle HTTP GET requests using Connect. Refer to the documentation that corresponds to your server:

Afterwards, ensure that a new enough version of @connectrpc/connect-web is set up; HTTP GET support is available in Connect Web v0.9.0 or newer. Then, you can specify the useHttpGet option when creating the Connect transport:

const transport = createConnectTransport({
baseUrl: "",
useHttpGet: true,
const client = createPromiseClient(ElizaService, transport);
const response = await client.say(request);

Methods annotated as side-effect free will use GET requests. All other requests will continue to use POST.