tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
83.31k stars 2.5k forks source link

add url rewrite support #2993

Open cjdxhjj opened 2 years ago

cjdxhjj commented 2 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] i have few front end projects, write by vue, react, and angular, when build to assert and place to the dist folder, it works well, but i found an debug warn that Asset xxx not found; fallback to index.html the xxx is the html5 push url, front url, the taruri search the xxx/index.html, when it not exist then fall back to index.html the behavior is strange,the brower work well with the html5 push api, the tauri treat it as a local assert,

Describe the solution you'd like A clear and concise description of what you want to happen. provider the url rewrite module, like apache httpd, for example: image

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

when the url rewrite mod is on ready for use, i could simple pack many front projects in my package, the request could routed to the correct front assert,

Additional context Add any other context or screenshots about the feature request here.

cjdxhjj commented 2 years ago

i found the some code in tauri image

cjdxhjj commented 2 years ago

that may enhance to support the url rewrite.

Farnsi commented 2 years ago

Or simple remove all URL rewrites and use the same behavior as browsers do.

FabianLars commented 2 years ago

Or simple remove all URL rewrites and use the same behavior as browsers do.

The problem with that is that Tauri is not just the browser but also the server in this context. So removing everything again, will reintroduce the problems that made us add these rewrites (most prominently SPA stuff like routing) in the first place.

cjdxhjj commented 1 year ago

is there any plan to support this feature request?

Farnsi commented 1 year ago

The problem with that is that Tauri is not just the browser but also the server in this context. So removing everything again, will reintroduce the problems that made us add these rewrites (most prominently SPA stuff like routing) in the first place.

I must admit, i did not check the reasons why you do it (i think it has a good reason). I only think about why not use different ports or protocol-schemes for your own server stuff. So that the "user-space" web app can run without modification, without redirects, or add redirects, if redirects are set in config.

cjdxhjj commented 1 year ago

my application has many front project, each dist many js and css files. i'm have a main entry of that apps. i want to package the other app resource in the app and config it router, when the url match the config path, tauri load the html file

cjdxhjj commented 1 year ago

i have tried some spa framework, such as https://github.com/single-spa/single-spa that framework config some url mapping to html file a and other url mapping html file b, but the sub app must retrofit for it