Skip to content
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

Hot reloading and local HTTPS #307

Open
kakserpom opened this issue Jun 25, 2024 · 5 comments
Open

Hot reloading and local HTTPS #307

kakserpom opened this issue Jun 25, 2024 · 5 comments

Comments

@kakserpom
Copy link

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
Copy link
Contributor

gbj commented Jun 25, 2024

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
Copy link
Author

kakserpom commented Jun 26, 2024

# 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');

@carina-akaia
Copy link

reload-ws-protocol = "wss" in Cargo.toml doesn't work for me either

@gbj
Copy link
Contributor

gbj commented Aug 25, 2024

Apologies for the slow response. It looks like this is not being read out of the Cargo.toml at all, but an env variable — or can be set in main.rs of course.

So either

LEPTOS_RELOAD_WS_PROTOCOL=wss cargo leptos watch

or

    let conf = get_configuration(None).await.unwrap();
    let mut leptos_options = conf.leptos_options;
    leptos_options.reload_ws_protocol = "wss".into();

works when I test it.

@carina-akaia
Copy link

works when I test it.

Can confirm, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants