Spanish Total.js
English
Documentation For AI agents
Contents

Send requests to another server

Make an app talk to another server without changing the app: your computer in the place of production, for example.

.md GitHub
On this page

Make the rule

  1. Right-click a request of the server that you want to replace and choose Send it to another server…
  2. In Addresses, leave only the host, such as api.example.com, for all its addresses. To replace a part, write it as api.example.com/users*.
  3. In Send to, write the other server, such as http://localhost:8000.
  4. Press Keep the rule.

For an HTTPS server, its domain must be read too.

Where each request goes

The server that you write takes the place of the original one. The path and the query stay:

The app asksSend toIt goes to
https://api.example.com/users?page=2http://localhost:8000http://localhost:8000/users?page=2
https://api.example.com/usershttps://staging.example.com/v2https://staging.example.com/v2/users

The method, the headers and the body go as the app sent them, except the name of the host. The app does not know that another server answers.

The cookies and tokens of the app go to the other server too. Send them only to a server that you trust.

See that it works

The request keeps its address in the list, with rule next to its path. Choose it and you read Sent to … with the address where it went.

If the other server is not running, the app gets an error 502, and the request says why.

Go back

Turn the rule off in Rules (⌘R on the Mac, Ctrl+R on Windows and Linux). The next request goes to the original server.

Made in Europe