TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/outray-tunnel/outray/llms.txt
Use this file to discover all available pages before exploring further.
@outray/vite plugin integrates with Vite’s configureServer hook to start an OutRay tunnel as soon as the dev server begins listening. The tunnel URL appears in the terminal alongside Vite’s local and network URLs.
The plugin uses
apply: "serve" and only runs during vite dev. It is completely inactive during builds.Setup
Add the plugin to your Vite config
Import
outray and add it to the plugins array in vite.config.ts:vite.config.ts
Configuration
Pass an options object tooutray():
vite.config.ts
Options
| Option | Type | Default | Description |
|---|---|---|---|
subdomain | string | — | Request a specific subdomain. Requires authentication. |
customDomain | string | — | Use a custom domain configured in the OutRay dashboard. |
apiKey | string | process.env.OUTRAY_API_KEY | API key for authentication. |
serverUrl | string | wss://api.outray.dev/ | OutRay server WebSocket URL. Change this only for self-hosted instances. |
enabled | boolean | process.env.OUTRAY_ENABLED !== "false" | Enable or disable the tunnel. |
silent | boolean | false | Suppress all tunnel status logs. |
local | boolean | false | Enable LAN access via mDNS (.local domain) for devices on the same network. |
onTunnelReady | (url: string) => void | — | Called when the tunnel is established. |
onLocalReady | (info: LocalInfo) => void | — | Called when LAN access is available. |
onError | (error: Error) => void | — | Called when the tunnel encounters an error. |
onClose | () => void | — | Called when the tunnel connection closes. |
onReconnecting | () => void | — | Called when the tunnel is attempting to reconnect. |
Environment variables
| Variable | Description |
|---|---|
OUTRAY_API_KEY | API key for authentication — fallback for the apiKey option. |
OUTRAY_SUBDOMAIN | Subdomain to request — fallback for the subdomain option. |
OUTRAY_SERVER_URL | Server WebSocket URL — fallback for the serverUrl option. |
OUTRAY_ENABLED | Set to "false" to disable the tunnel without removing the plugin. |
Examples
Custom subdomain
Reserve a consistent URL for your project:vite.config.ts
Custom domain
Use a domain you’ve configured in the OutRay dashboard:vite.config.ts
Callbacks
React to tunnel lifecycle events:vite.config.ts
Silent mode
Suppress all console output and handle the URL yourself:vite.config.ts
Framework integration
The plugin works with any Vite-based framework. Add it alongside your existing framework plugin:- React
- Vue
- Svelte
- SolidJS
vite.config.ts
TypeScript
The package exportsOutrayPluginOptions for typed configuration:
vite.config.ts
OutrayPluginOptions interface:
Compatibility
- Vite: 4.x, 5.x, 6.x, 7.x
- Servers: TCP ports only — Unix domain sockets are not supported.
Troubleshooting
Tunnel not starting- Confirm your Vite dev server is listening on a TCP port.
- Check that
OUTRAY_ENABLEDis not set to"false". - Verify your API key is valid if using a reserved subdomain.
- Run
outray loginto authenticate, or setOUTRAY_API_KEY.
- The plugin reconnects automatically on connection loss.
- Confirm the server URL is correct (default:
wss://api.outray.dev/).