tauri-apps / tauri-invoke-http

A custom invoke system for Tauri that leverages a localhost server
Apache License 2.0
48 stars 5 forks source link

Removed custom-protocol feature but tauri://localhost is still used #7

Closed elanzini closed 1 year ago

elanzini commented 1 year ago

Context

I recently opened this discussion. It sounded like this could fix my issues, since in my case I want the requests to have as Origin http://localhost.

What I tried

In my Cargo.toml, I removed the custom-protocol from the default features.

Before:

[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

After:

[features]
default = [ ]
custom-protocol = [ "tauri/custom-protocol" ]

And I have included the dependency as follows (also tried with branch release):

[dependencies]
tauri-invoke-http = { git = "https://github.com/tauri-apps/tauri-invoke-http", branch = "dev" }

But when I run npm run tauri build, the requests still have tauri://localhost as their Origin. Am I doing something wrong? Do I need to build with a specific flag?

FabianLars commented 1 year ago

I think you're looking for https://github.com/tauri-apps/tauri-plugin-localhost. tauri-invoke-http is just for changing the IPC, not the page origin.

Also, removing it from the default features, doesn't change anything. actually disabling the custom-protocol feature would effectively just tell tauri to use the devPath instead of distDir (which doesn't work because there is no localhost server).

elanzini commented 1 year ago

Thanks again @FabianLars 🍻 - I have tried integrating the plugin you pointed to and ran into an issue - opened a ticket in the repository directly: https://github.com/tauri-apps/plugins-workspace/issues/155

Sorry for the confusion and thanks for the explanation - my knowledge is quite limited in this context - will close this issue.