Skip to content

@tauri-apps/plugin-http

Make HTTP requests with the Rust backend.

This API has a scope configuration that forces you to restrict the URLs that can be accessed using glob patterns.

For instance, this scope configuration only allows making HTTP requests to all subdomains for tauri.app except for https://private.tauri.app:

{
"permissions": [
{
"identifier": "http:default",
"allow": [{ "url": "https://*.tauri.app" }],
"deny": [{ "url": "https://private.tauri.app" }]
}
]
}

Trying to execute any API with a URL not configured on the scope results in a promise rejection due to denied access.

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L86

Options to configure the Rust client used to make fetch requests

2.0.0

Property Type Description Defined in
connectTimeout? number Timeout in milliseconds Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L97
danger? DangerousSettings Configuration for dangerous settings on the client such as disabling SSL verification. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L105
maxRedirections? number Defines the maximum number of redirects the client should follow. If set to 0, no redirects will be followed. When the scopeRedirects plugin configuration is enabled, every redirect must also be allowed by the configured scope, otherwise the request fails instead of being followed. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L95
proxy? Proxy Configuration of a proxy that a Client should pass requests to. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L101

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L113

Configuration for dangerous settings on the client such as disabling SSL verification.

2.3.0

Property Type Description Defined in
acceptInvalidCerts? boolean Disables SSL verification. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L117
acceptInvalidHostnames? boolean Disables hostname verification. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L121

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L36

Configuration of a proxy that a Client should pass requests to.

2.0.0

Property Type Description Defined in
all? string | ProxyConfig Proxy all traffic to the passed URL. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L40
http? string | ProxyConfig Proxy all HTTP traffic to the passed URL. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L44
https? string | ProxyConfig Proxy all HTTPS traffic to the passed URL. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L48

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L56

Detailed configuration of a single proxy server, used when a plain URL string is not enough.

2.0.0

Property Type Description Defined in
basicAuth? object Set the Proxy-Authorization header using Basic auth. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L64
basicAuth.password string The password sent to the proxy server. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L72
basicAuth.username string The user name sent to the proxy server. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L68
noProxy? string A configuration for filtering out requests that shouldn’t be proxied. Entries are expected to be comma-separated (whitespace between entries is ignored) Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L78
url string The URL of the proxy server. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L60

function fetch(input, init?): Promise<Response>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/http/guest-js/index.ts#L150

Fetch a resource from the network. It returns a Promise that resolves to the Response to that Request, whether it is successful or not.

The request is performed by the Rust backend instead of the webview, so it is not subject to CORS, but the URL must be allowed by the plugin scope.

Parameter Type Description
input | string | URL | Request The resource to fetch, as a URL, a string or a Request object.
init? RequestInit & ClientOptions The standard fetch request options, extended with the Rust client options from ClientOptions: maxRedirections, connectTimeout, proxy and danger. The signal option can be used to abort the request.

Promise<Response>

A promise resolving to the Response of the request.

import { fetch } from '@tauri-apps/plugin-http';
const response = await fetch("http://my.json.host/data.json");
console.log(response.status); // e.g. 200
console.log(response.statusText); // e.g. "OK"
const jsonData = await response.json();

2.0.0


© 2026 Tauri Contributors. CC-BY / MIT