dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Intercept HTTP requests from UI

Open Sitin opened this issue 10 months ago • 2 comments

Allow to intercept HTTP calls (and generally any resource) from JavaScript / WebView / WASM, etc.

Reasoning

While Rust ecosystem is growing, we are still have to use 3rdparty JS libraries. Sometimes it is advantageous to intercept requests from such libraries for caching or adding access tokens (or headers). This also may help to sanitize behavior of 3rdparty Dioxus components.

Possible implementation

Add a middleware layer that allows to register intercept handlers during Dioxus application init phase. The user should explicitly register such handlers including those required for 3rdparty libraries and plugins.

Sitin avatar Apr 05 '25 05:04 Sitin

We don't have a cross platform abstraction for this yet, but on desktop you can use a custom handler like this example and on web you can use a service worker

ealmloff avatar Apr 07 '25 13:04 ealmloff