Skip to content

[bug] HttpAllowlistScope to allow all ports on localhost #5208

@abeggchr

Description

@abeggchr

Describe the bug

It does not seem to be possible to configure a scope under allowlist > http which allows all ports on localhost.

Reproduction

  1. In tauri.conf.json under tauri > allowlist > http > scope add an empty array.
  2. Insert scope value "http://**" in the empty array.
  3. Start Tauri
  4. In the application, make a HTTP request to http://localhost:8080/api
  5. The request is successful
  6. Change scope value to "http://localhost:**", start Tauri
  7. Behavior: Tauri does not start with error message Malformed URI: invalid port number
  8. Change scope value to "http://localhost", start Tauri
  9. Behavior: the request fails because url not allowed on the configured scope: http://localhost:8080/api"

Expected behavior

It should be possible to configure a scope under allowlist > http which allows all ports on localhost so that Tauri starts and requests can be executed.

Platform and versions

Environment
› OS: Windows 10.0.22000 X64
› Webview2: 105.0.1343.33
› MSVC:
- Visual Studio Professional 2022
- Visual Studio Build Tools 2017
› Node.js: 16.16.0
› npm: 8.18.0
› pnpm: 6.11.0
› yarn: 1.22.15
› rustup: 1.25.1
› rustc: 1.63.0
› cargo: 1.63.0
› Rust toolchain: stable-x86_64-pc-windows-msvc

Packages
› @tauri-apps/cli [NPM]: 1.0.5 (outdated, latest: 1.1.0)
› @tauri-apps/api [NPM]: 1.0.2 (outdated, latest: 1.1.0)
› tauri [RUST]: 1.0.5,
› tauri-build [RUST]: 1.0.4,
› tao [RUST]: 0.12.2,
› wry [RUST]: 0.19.0,

App
› build-type: bundle
› CSP: unset
› distDir: ../dist
› devPath: http://localhost:5173/
› framework: React

App directory structure
├─ .idea
├─ dist
├─ node_modules
├─ public
├─ src
└─ src-tauri

Stack trace

No response

Additional context

Trying to allow all local ports because port is assigned dynamically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions