#tauri #plugin #localhost #tauri-plugin


Expose your apps assets through a localhost server instead of the default custom protocol

4 releases

2.0.0-alpha.2 Sep 7, 2023
2.0.0-alpha.1 Aug 14, 2023
2.0.0-alpha.0 May 24, 2023
0.1.0 Jun 19, 2022
Download history 102/week @ 2023-06-05 153/week @ 2023-06-12 81/week @ 2023-06-19 71/week @ 2023-06-26 90/week @ 2023-07-03 83/week @ 2023-07-10 214/week @ 2023-07-17 127/week @ 2023-07-24 89/week @ 2023-07-31 89/week @ 2023-08-07 117/week @ 2023-08-14 58/week @ 2023-08-21 102/week @ 2023-08-28 144/week @ 2023-09-04 146/week @ 2023-09-11 118/week @ 2023-09-18

514 downloads per month
Used in holochain_cli_launch

Apache-2.0 OR MIT

102 lines


Expose your apps assets through a localhost server instead of the default custom protocol.

Note: This plugins brings considerable security risks and you should only use it if you know what your are doing. If in doubt, use the default custom protocol implementation.


This plugin requires a Rust version of at least 1.65

There are three general methods of installation that we can recommend.

  1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
  2. Pull sources directly from Github using git tags / revision hashes (most secure)
  3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)

Install the Core plugin by adding the following to your Cargo.toml file:


portpicker = "0.1" # used in the example to pick a random free port
tauri-plugin-localhost = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }


First you need to register the core plugin with Tauri:


use tauri::{Manager, window::WindowBuilder, WindowUrl};

fn main() {
  let port = portpicker::pick_unused_port().expect("failed to find unused port");

    .setup(move |app| {
        RemoteDomainAccessScope::new(format!("localhost:{}", port))

      let url = format!("http://localhost:{}", port).parse().unwrap();
      WindowBuilder::new(app, "main".to_string(), WindowUrl::External(url))
        .title("Localhost Example")
    .expect("error while running tauri application");


PRs accepted. Please make sure to read the Contributing Guide before making a pull request.


Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.

MIT or MIT/Apache 2.0 where applicable.


~1M SLoC