Skip to main content

Module LocalhostPlugin

Module LocalhostPlugin 

Source
Expand description

ยงLocalhost Plugin Module

Configures and creates the Tauri localhost plugin with CORS headers for Service Workers and an OTLP proxy for build-baked telemetry.

Constantsยง

OTLP_HOST ๐Ÿ”’
OTLP collector host:port. OTELBridge.ts sends to /v1/traces (same-origin), this proxy forwards to the real collector via raw TCP. Zero CORS issues.

Functionsยง

LocalhostPlugin
Creates and configures the localhost plugin with CORS headers preconfigured.
MimeFromUrl ๐Ÿ”’
Resolve the correct Content-Type for a request URL by its file extension.
ProxyToOTLP ๐Ÿ”’
Forward a JSON body to the OTLP collector via raw HTTP/1.1 POST. Returns true if the collector accepted (2xx), false otherwise.