pub fn land_scheme_handler(request: &Request<Vec<u8>>) -> Response<Vec<u8>>Expand description
Handles land:// custom protocol requests
This function is called by Tauri when a webview makes a request to the
land:// protocol. It routes the request to local HTTP services via the
ServiceRegistry.
§Parameters
request: The incoming webview request with URI path and headers
§Returns
A Tauri response with:
- Status code from local service (or error status)
- Headers from local service plus CORS headers
- Response body from local service (or error body)
§Implementation Details
- Parse the land:// URI to extract domain and path
- Look up the service in the ServiceRegistry
- Handle CORS preflight (OPTIONS) requests
- Check cache for static assets
- Forward the request to the local service
- Add CORS headers to the response
- Cache static assets for future requests
§Error Handling
- 400: Invalid URI format
- 404: Service not found in registry
- 503: Service unavailable / request failed
§Example
tauri::Builder::default()
.register_uri_scheme_protocol("land", |_app, request| land_scheme_handler(request))