leptos-rs / cargo-leptos

Build tool for Leptos (Rust)
MIT License
320 stars 93 forks source link

Hot reloading and local HTTPS #307

Open kakserpom opened 4 days ago

kakserpom commented 4 days ago
let ws = new WebSocket('ws://' + host + ':3001/live_reload');

This should take current protocol (http/https) into account. Secure documents cannot call unsecure resources due to browser policies.

A cli argument for a custom WS url won't hurt either. That way we could run local-ssl-proxy on a different port.

In my development environment I need local HTTPS to integrate with OAuth providers and whatnot. Right now I am sacrificing hot reloading altogether (being too lazy).

gbj commented 3 days ago

Just a documentation issue. Here is the relevant code:

https://github.com/leptos-rs/leptos/blob/c9d0ef503335e1ac4a3ca93f1045a6a7d10cc7b8/integrations/utils/src/lib.rs#L15-L25

As you can see it comes from a reload_ws_protocol argument which I guess would be reload-ws-protocol in Cargo.toml, but I see that's not in the README here.

kakserpom commented 2 days ago
# The IP and port (ex: 127.0.0.1:3000) where the server serves the content. Use it in your server setup.
site-addr = "127.0.0.1:3000"
reload-ws-protocol = "wss"
reload-external-port = 3002
# The port to use for automatic reload monitoring
reload-port = 3001

It doesn't affect anything.

I am still getting this: let ws = new WebSocket('ws://' + host + ':3001/live_reload');