Subshell Docs

Web app previews

Open a website running on your node beside its subshell.

Before you start

Follow Preview prerequisites and setup for the node setting and access you need. Automatic port discovery requires Linux; use a saved service for a web server on macOS.

How the preview runs

A web preview loads your app in an iframe, an embedded page inside the Subshell dashboard. The app's JavaScript runs in the browser on the device you're viewing from. Subshell forwards requests through a private preview URL to one host and port reachable from the node.

By default, the iframe runs in a sandbox that separates the app from your Subshell account. The preview URL also changes the address and path the app sees. These differences mean a locally hosted app can work in a browser on the node and still fail in a preview. Subshell adapts common app patterns, but can't fully support every local service or browser feature. See Browser compatibility and private links for limitations and ways to improve compatibility.

Check a website

  1. Start your project's dev server inside a subshell. Keep it listening on loopback; you don't need to expose its port to your network.
  2. Use the Web previews & screens icon in the subshell header. A window icon means the subshell has a virtual display; otherwise the header uses a globe. Its badge counts views you can open that haven't been saved: discovered ports without a saved service, plus an available screen and browser watch. Opening a port doesn't save it; Add service removes that port from the count.
  3. In Open web preview or screen, choose the Web preview row for your dev server's port.
  4. Check the site in the preview beside the terminal. Try navigation, forms, filters, and other interactions, then give your agent specific feedback.
Subshell header showing the Dev server pane with its Web previews and screens icon wearing a count of three.
The badge shows 3 available views: two discovered web ports plus one browser watch.

See Arrange and refresh views for workspace tabs and toolbar controls.

Add a service started elsewhere

Use a saved service when your web server runs outside the subshell or its port isn't discovered automatically.

  1. Use the Web previews & screens icon in the subshell header, then choose Add service under Saved services.
  2. Enter the service's Port and choose HTTP or HTTPS. You can add a name to make it easier to recognize.
  3. Leave Host under Advanced as localhost for a service on the subshell's node. For a service on another machine, enter a hostname or IP that the node can reach. Hostnames resolve on the node, not on the device viewing the dashboard.
  4. Choose Save service, then select the saved row to open its workspace tab.

The subshell must be running. HTTPS requires a certificate the node trusts and whose name matches the host by default. For a service you trust that uses a self-signed or mismatched certificate, select Ignore certificate validation when adding the HTTPS service. This applies only to that saved service: traffic stays encrypted, but Subshell can't verify the server's identity. To change an existing service's certificate setting, use its Edit button.

Saved connections stay with the subshell across reloads and closed tabs. Use the remove button beside a saved row to delete the connection and disconnect its open views. Removing a connection doesn't stop the service. People with view access can see the list but can't open or change its connections.

Subshell’s website loaded in a landscape web preview, with enlarged text and preview controls.
The saved website service open in a web preview. Navigate and interact with it directly in your workspace.

Configure an app preview

Choose a discovered app in Open web preview or screen to open its configuration step. Select the protocol and adjust the options, then choose Open preview. To keep the configuration, select Save this configuration, optionally give it a name, and choose Save and open.

Add service offers the same options for a custom host and port. Use Edit beside a saved service to change its name, destination, or options. Save changes disconnects its open previews; open the saved service again to use the new settings. For an app that's already open, More view actions → Configure preview opens these controls too.

SettingDefaultWhat it changes
ProtocolHTTPChooses HTTP or HTTPS for the connection from the node.
Ignore certificate validationOffSkips certificate and hostname checks for this HTTPS destination.
Rewrite app URLsOnRoutes supported app URLs through the private preview path.
Pass the preview hostOffSends your browser's preview host to the app instead of the target host.
Rewrite redirectsOnKeeps redirects to this app under the preview path.
Run outside the sandboxOffAllows browser features that isolation blocks, including storage and some sign-in flows.

A saved service keeps these options with its name and destination. People with edit access can change it. Opening a saved service with Run outside the sandbox enabled shows its configuration and warning before opening.

Running outside the sandbox trusts the website with your Subshell account. It can access your browser session and data, interact with the dashboard, and act with your account's permissions. Only enable this for a site and everyone who can change it that you fully trust. The preview remains restricted to the account that opened it; sharing its link doesn't authorize another account to run it.

Local addresses and multiple services

The saved service's Host is resolved on the node. An address used by your app's browser-side JavaScript is different: if it isn't rewritten through the preview, localhost and 127.0.0.1 refer to the device viewing the dashboard. For example, a phone viewing a frontend on the node can't reach the node's API by fetching http://localhost:8000.

With Rewrite app URLs enabled, Subshell rewrites supported HTML attributes, CSS URLs, and module imports. It also adds a browser compatibility script for common requests such as fetch, XMLHttpRequest, WebSocket, and EventSource. URLs for other hosts or ports stay external. Opening a second preview doesn't automatically connect it to the first app's API requests.

Common limitations

What may failWhy it happens
Assets, routes, or API callsAn app may build URLs that escape the preview path, assume it lives at /, or call a separate local service. Rewriting covers common patterns, not arbitrary JavaScript.
Live reload or hot module replacement (HMR)The page can load while its WebSocket connection points at another port or a hardcoded local address.
Browser storage and service workersThe default sandbox gives the page an isolated, opaque origin. Features such as localStorage, IndexedDB, and service workers aren't available as they would be on the app's own origin.
Cookies and sign-inTarget cookies stay in a server-side jar, so app JavaScript can't manage them through document.cookie. The jar keys cookies by name, without normal browser path and domain scoping. Login flows that depend on these behaviors, an exact callback URL, or leaving the iframe may fail.
Header-based authenticationThe proxy strips Authorization and X-Api-Key request headers and HTTP authentication challenges to protect dashboard credentials. Apps that depend on them may not work through the preview.
Strict browser or app policiesContent Security Policy (CSP) can block the injected compatibility script or resources. App host and origin checks, and browser rules for external requests, can also reject traffic.

The iframe permits scripts and forms, but doesn't grant every browser capability. MDN's iframe sandbox reference explains how embedding and sandbox permissions affect a page.

Improve your app's compatibility

Make these changes in your application's development configuration on the node:

  1. Keep browser requests on one app origin. Prefer relative asset and API URLs over hardcoded hosts. If the frontend runs on port 3000 and its API on port 8000, configure the frontend's dev server to proxy /api to that API. Browser code can then fetch /api/items through the frontend preview.
  2. Keep URL and redirect rewriting enabled to start. Use the preview configuration controls to check them. If your framework exposes a public URL, base path, or router base setting, make sure it supports being served beneath a path. Don't bake a private preview URL into source code; its access reference changes between previews.
  3. Route live reload through the same service. Configure the dev server's HMR or WebSocket endpoint to use the app's host and port, allowing the preview to rewrite it. A separate hardcoded socket address won't gain a tunnel from opening the page. Check the browser's Network panel if the page loads but updates stop.
  4. Check rejected requests before changing policies. Use the browser's Console and Network panels and the dev server's logs to identify the failed URL or check. The app receives its target Host by default; Pass the preview host changes that to the dashboard's host. Allow only the development hosts your app needs. Keep any CSP changes scoped to development, and use a normal browser if your policy must block injected scripts.
  5. Let optional browser features fail gracefully. Catch storage-access errors and provide an in-memory fallback where practical. Skip service-worker registration in preview development when it isn't part of the behavior you're testing. Test storage, offline behavior, and authentication in the app's normal browser context.

When to use a normal browser

In the preview toolbar, More view actions → Open in browser tab removes the surrounding iframe. It still opens the private proxy URL, and the default sandbox also applies through response headers. This doesn't restore the app's original origin, cookie behavior, or access to other local ports.

Run outside the sandbox can help a fully trusted app that needs browser storage or some sign-in features. It leaves the iframe, proxy, cookie jar, and credential filtering in place, so compatibility still isn't guaranteed. Read the account-access warning before enabling it.

For apps that need their normal origin or browser capabilities, open the app's original URL in a browser on the node. A virtual display lets you control that browser from Subshell. You can also use the original URL directly from another device if that device already has network access to the app; a loopback address still refers to that device.

Treat a preview URL as a private access link. Anyone who receives it can use it while its session remains valid, and closing a tab doesn't immediately revoke a copied link. Remove a saved service to revoke its connections, or remove access or end the subshell to revoke existing access. Turning off previews on the node doesn't immediately revoke existing connections.

The server can read forwarded app traffic. See Preview security for the trust boundaries and Architecture for the data path.

For implementation details, read Web preview architecture and Develop and extend web previews.

Edit on GitHub

Last updated on

On this page