-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to make tauri use http://tauri.localhost/ instead of https://tauri.localhost/ ? The page was blocked since the page was loaded over HTTPS. #3007
Comments
I met the same problem too. |
Me too. Electron supports this mode, and it is extremely useful for development and testing, even in some rare production env. |
Can you post Also please explain your feature request a bit further and how the api for it should look like, as I am having some trouble understanding your request. |
I don't want to hijack the thread but here is mine:
When running socketio client and connecting to a bundled python-based socketio server, I am facing exact same errors. Due to some reasons, only ws/http are accepted unfortunately. It seems to me that the only solution is somehow to support hosting over http. Please advise if you have any questions or comments. Update: this is not a problem when just connecting to localhost, but becomes an issue when connecting from other ip. |
Thank you for your participation.
|
cargo tauri info:
The WebView console shows the following errors:Maybe the API looks like this:
|
Switching to |
Thank you for the heads up. Currently I'm only using the sidecar api, so hopefully it won't get affected, but I do hope we could have this option. Sometimes people turn to Tauri just because it could generate smaller and more performant app, instead of more native api supports. |
same problem to me. |
yeah it doesn't affect sidecar afaik. Here is a list on MDN of features/apis that won't work if I have a vague memory about |
Does that mean this feature is already supported? If so, do you mind to explain how to enable it? If not, do you have plan to add the feature? Thanks |
I'll check this. |
Unfortunately we need the |
Thanks! Could we choose to disable the secure content? I'm trying to query a socketio server and due to some reasons it has to be either http or ws. |
I met the same problem.Because of historical reasons can not support wss,in this case windows compiler software becomes unusable, which should be a common situation.
hi, @lucasfernog This plugin needs my local yarn start the app and keep it running? I found that the source code can only run localhost, and I can't use other particular ip as a parameter? |
Based on the following sources: Chrome: Both |
The plugin only applies to a production build. Why would you need a particular IP? Sorry for the lack of documentation, we're focusing on releasing tauri v1.0.0-rc.0 for now. |
Yeah but that's not the case on Windows using Webview2. |
Maybe Webview2 is changing this soon? MicrosoftEdge/WebView2Feedback#2102 (comment) |
@lucasfernog Can the Tauri plugin localhost program support WS and HTTP protocols after cargo Tauri build |
Yes it'll work @wangyuxiangloveyou |
Closing as the localhost plugin can be used to achieve this and we shouldn't allow insecure content by default. |
Property useHttp is not allowed |
no,there http is not work |
Any news update? we still need to use the plugin? cause the other platforms such as ubantu macos were not need it. |
Still facing same problem, is there any update. I am using websocket to connect to localhost, after release, it tried to connect https. How can i connect to http in release mode |
Any fix for this yet? Or we have to use localhost plugin? |
Hi, Packages App App directory structure If any one able to find solution for tauri app running on different pc, for me, it is not working even after changing http://localhost:8000 with http://ip_address:8000 please update so that other can also able to find solution |
For anyone struggling with the localhost plugin not working for
use tauri::{utils::config::AppUrl, window::WindowBuilder, WindowUrl};
// Tauri by default uses HTTPS, so use the localhost plugin to downgrade back to
// HTTP. However, when running tauri dev, we already have a localhost server
// provided by vite, so don't enable it
#[cfg(debug_assertions)]
const USE_LOCALHOST_SERVER: bool = false;
#[cfg(not(debug_assertions))]
const USE_LOCALHOST_SERVER: bool = true;
fn main() {
let port = portpicker::pick_unused_port().expect("failed to find unused port");
let window_url = if USE_LOCALHOST_SERVER {
WindowUrl::External(format!("http://localhost:{}", port).parse().unwrap())
} else {
WindowUrl::App("index.html".into())
};
let mut context = tauri::generate_context!();
let mut builder = tauri::Builder::default();
if USE_LOCALHOST_SERVER {
// rewrite the config so the IPC is enabled on this URL
context.config_mut().build.dist_dir = AppUrl::Url(window_url.clone());
context.config_mut().build.dev_path = AppUrl::Url(window_url.clone());
builder = builder.plugin(tauri_plugin_localhost::Builder::new(port).build());
}
builder
.setup(move |app| {
WindowBuilder::new(app, "main".to_string(), window_url)
.title("Localhost Example")
.build()?;
Ok(())
})
.run(context)
.expect("error while running tauri application");
} |
I am still getting this error when I try to request a http address. How do I fix it? |
any updates? my app can send http request normally on windows, but immediately fail on macOS |
@pot-code I am 99% sure your problem is unrelated to this issue. This one is windows-only and its fix won't touch the MacOS and Linux implementations at all. My first idea would be that it may be related to the |
@FabianLars Thank you for your help! It is because I had set the |
|
Maybe we could talk about it? I had a similar problem |
If anyone has encountered this problem, please pay attention to this PR: Allow http origin on Windows |
Co-authored-by: Lucas Nogueira <[email protected]> Co-authored-by: Lucas Nogueira <[email protected]>
i change the |
This comment has been minimized.
This comment has been minimized.
you are an angel, thank you... |
This comment has been minimized.
This comment has been minimized.
为啥我的还是不行啊,我要碎了,不清楚我的配置是不是还需要修改什么 |
你可以看看allowlist有没有放行 |
you're an Angel! mua ,mua ,mua |
Is your feature request related to a problem? Please describe.
WebView console shows the following errors when we connect to endpoint 'ws:/':
Mixed Content: The page at '<URL>' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws:<URL>/'. This request has been blocked; this endpoint must be available over WSS.
Describe the solution you'd like
We should allow to set an option in tauri.conf.json to use http://tauri.localhost/ instead of https://tauri.localhost/.
Describe alternatives you've considered
None.
Additional context
The text was updated successfully, but these errors were encountered: