-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
use a localhost server instead of wails custom protocol (https://wails.localhost) #2116
Comments
Are you suggesting using this for production builds? |
yes, I want wails production builds protocol is localhost:xxxx instead of https://wails.localhost/ |
How would this differ from hybrid mode #1652 that only binds on localhost? |
now, I changed http://wails.localhost/ to http://localhost:8888/, |
Cool. What connects to http://localhost:8888? |
By changing that const basically the internal assetserver for Windows is assigned to that url. That won't bind the frontend to localhost:8888 on the network stack of the host. |
Maybe you could elaborate a little bit more what you are trying to achieve?
|
|
I was going to open a very similar request so in the sake of consolidation I will add to this one. Maybe I am understanding the server/hybrid mode wrong so if I do please correct me. What i want to achieve is that my wails app will listen on localhost:xxxx instead of wails://. (pretty much like it does in dev mode) The reason for this is that we are planning to use wails for internal tools which all rely on oauth authentication. Part of this flow are callback urls and most providers only accept FQDNS and localhost. In my understanding this is not really server mode (only webserver no window) nor hybrid (external server listening to localhost:xxx and window using wails:// ) |
The current hybrid proposal would then use
Do they also require |
I did not see this when I looked into the hybrid branch. But this is exactly what I would need.
oauth is a complicated beast. Those callback urls are not really callbacks. They are redirect targets. So you make a call to a provider. Which responds with a redirect to a url which is inside your app. This then makes further calls to finish the code exchange. So to answer the question http will work. |
Thanks for linking the rfc, didn't know that rfc 🙏. Wonder if we might handle that with internally rewriting those redirects in the webview. That should be pretty simple for Windows, for macOS and linux it's a bit more complicated. |
Our environment is cross platform windows/linux, But if you have an idea on how to approach this. I have a working testversion in dev mode so i could try out any kind of rewrite approach. (I just fear some interesting CORS issues) |
Yeah, I'll try to put something together. |
In app is fine (actually preferred) |
Did this finally work. I am looking to run a localhost myself. #2189 |
Here's a workaround for how I wrote a localhost server (on port 5173) in a production "wails build" so that it performs the OAuth2 dance like it does in the "wails dev" case: For my wishlist, I would love it if wails provided a "-headless" mode so that I could still run this exact same executable in a Kubernetes container and it would serve my app as a web app without popping up a local window. That way, the very same executable could be either a standalone app running locally or an app running over the web. To me, this would be the best of both worlds because wails provides such an awesome development environment for writing web-based apps! (Currently, I'm using vite+vue3 inside of wails.) |
A couple of questions @gmlewis - I'm looking to make an oauth2 plugin for Wails v3. Would it be possible for you to please point me to any documentation around how it works and how you implemented it? Secondly, how would you see a server app working for a multi-window application? I'm thinking you could only really show the main window, but that might be ok? EDIT: 3rd question - would your headless mode be a cli flag that would disable normal windows but open a server and serve the assets that way? What about the logic you would have around your windows like events? I'm not sure the same binary could be used for server as it would probably still try and open the libwebkit libraries. Might have to be different builds |
@leaanthony - in my experience, implementing the OAuth2 dance is always a pain and takes a lot of trial and error to get right. I haven't found a really great or concise description of how it works, but the two major platforms I've implemented solutions for in the past are for Google APIs and for use with Keycloak. Otherwise, any other documentation that shows you how to use a redirect URI with OAuth2 should be helpful. For a multi-window application, I think you are right that this would really be useful only for the main window, but since I'm typically writing SPA web apps, that is OK for me. 3rd question - yes, exactly right - the As for the exact same binary, after I wrote that I realized that this might have to be a build flag, which is totally fine with me. So one binary would be the "headed" (desktop-with-libwebkit) version and the other binary would be the "headless" build that only stands up the server and serves the assets. That would be awesome. And while I'm asking for ponies, TLS support on that server would be super-sweet. 😂 |
This is planned for v3.x. There's a workaround for v2 so closing for now. |
Is your feature request related to a problem? Please describe.
i want use a localhost server instead of wails custom protocol (https://wails.localhost)
example tauri app(rust) have support plugin: https://github.com/tauri-apps/tauri-plugin-localhost
Describe the solution you'd like
please support a localhost server instead of wails custom protocol, example http://localhost:8888
Describe alternatives you've considered
i had use framework fiber to server host localhost, it's very inconvenient.
Additional context
No response
The text was updated successfully, but these errors were encountered: