Introduction¶
DSH’s Web UI defaults to listening only on the loopback address, meaning only the local machine can access it. To open it on another computer or tablet on the local area network, you usually need to set up a reverse proxy yourself: starting a separate process, modifying configuration files, handling token links and WebSocket forwarding, and dealing with the hassle when dsh restarts.
dsh-lan-proxy turns this into a plugin: the toggle, status, and startup logs are embedded directly in the DSH settings page, starting and stopping with DSH, and no separate process needs to be maintained. Below is an introduction to its features, installation, and usage.
What is it¶
dsh-lan-proxy is a DSH plugin maintained by liveqte, licensed under MIT. Its core function is to expose the DSH Web UI, which only listens on 127.0.0.1, to the local area network via 0.0.0.0 reverse proxy, while handling a series of adaptation issues encountered when accessing from the LAN (authentication, protocols, directory selection) at the same time.
DSH’s philosophy is “Everything is a plugin,” and this plugin follows that approach: it does not change DSH’s own listening behavior, but solves the issue via a reverse proxy layer on the outside.
Key Features¶
- LAN Reverse Proxy: Listens on
0.0.0.0:<port>, accessible by any device on the LAN viahttp://<LAN_IP>:<port>/. - No-Config Toggle: One-click toggle in the settings page “LAN Reverse Proxy” tab, instant hot reload, no need to restart dsh.
- Port Configuration: Modify listening port and upstream port directly in the tab, changes take effect upon saving.
- Protocol Adaptation: Automatically rewrites Host/Origin to loopback, bridges WebSocket (RFC6455 frame encoding/decoding), and injects
crypto.randomUUIDpolyfill (LAN HTTP is a non-secure context, missing this API). - Browser Authentication Adaptation: Automatically handles the dsh web token ↔ cookie exchange, making the first LAN access seamless without needing to manually open a link with a token.
- Web-based Directory Selection: Disables the native OS folder dialog, fixed to an embedded “Select Workspace Directory” browser within the webpage, allowing directory selection on remote machines.
- Status and Logs: 2-second polling runtime status, upstream availability probe, LAN address list, and startup logs, with a built-in “Restart Proxy” button.
Installation and Activation¶
The installation command is as follows:
dsh plugin --profile web add "github:liveqte/dsh-lan-proxy#main"
The bundle layer stack is combined at startup, so you need to restart DSH Web for it to take effect. Verify two points: the “LAN Reverse Proxy” top-level menu appears in the settings page navigation; there is no plugin tree failed to load in the startup logs.
The runtime environment requires Node >= 20.
Typical Usage¶
1. Toggle LAN Access
Enter the “LAN Reverse Proxy” tab in the settings page and switch “Listen for LAN Access”. The instant status of the page toggle is written to the runtime file $DSH_HOME/profiles/web/lan-proxy.runtime.json (priority is higher than configuration defaults) and takes effect immediately.
2. Access from LAN
Open on other devices in the LAN:
http://<LAN_IP>:<port>/
The default listening port is 3080.
3. Adjust Ports
You can modify two types of ports directly in the tab:
- Listening Port: Binds to all network interfaces.
- Upstream Port: Points to
127.0.0.1. Setting it to0means automatically using DSH’s actual listening port.
4. Select Workspace
After installing the plugin, “Add Workspace” in the sidebar / session area changes to an embedded directory browser (host file system listing + create new folder), no longer popping up an OS dialog. This allows the LAN / remote browser to select a directory; accessing 127.0.0.1 locally also uses the embedded dialog.
Configuration Options¶
Configuration options and default values are as follows:
| Key | Default Value | Description |
|---|---|---|
enabled |
false |
Listen for LAN access (configuration default value; page toggle has higher priority and is persisted to the runtime file) |
port |
3080 |
Reverse proxy listening port (all network interfaces) |
upstreamPort |
0 |
Upstream port, 0 = automatically use DSH’s actual listening port |
maxLogLines |
500 |
Number of lines buffered for page logs |
bypassRules |
See below | Frontend JS rewrite rules table |
Configuration overrides are written to cordis.patch.yml in the profile layer (config on the id: lan-proxy line), and there is no need to modify files in the repository.
Bypassing Settings Page Restrictions¶
DSH 0.1.x’s browser-side only loads the settings page for loopback addresses (connection.isLoopback). Accessing “Settings → Model” from the LAN will result in: Failed to load provider directory: settings are unavailable in this browser.
dsh-lan-proxy’s handling method: when the proxy forwards the byte stream of /plugins/<id>/client.js, it rewrites the JS based on the rules table, fixing the blockage check to loopback. The server-side /api barrier is determined by the Host header, and the proxy has already changed the Host back to 127.0.0.1, so the server naturally allows it. This is a patch that modifies the actual bytes executed by the browser and is unrelated to the plugin loading order.
The built-in rules (for DSH 0.1.x) are only one: dsh-client-connection:isLoopback-mirror, which changes isLoopback: pageLocation… inside the dsh-client-connection client to isLoopback: true, allowing normal read/write on the settings/model/credentials page. If the official method of blocking changes, you only need to add a find/replace rule in the configuration (or override the bypassRules table); if the old rule’s find doesn’t match, it will automatically skip and prompt in the log panel. The rule status (hit count / last error) appears in the runtime status on the “LAN Reverse Proxy” settings page.
Use Cases and Precautions¶
Suitable for these scenarios: using the DSH Web UI on other devices in the local area network (another computer, tablet); not wanting to maintain a separate process for the reverse proxy; needing to select the host machine’s workspace directory on a remote browser.
Pay attention to a few points before use:
- The toggle and port modification interfaces are limited to calls from the local machine’s loopback address; LAN access is read-only for status and logs. Even so, exposing the service to the LAN means devices on the same network can access your DSH Web UI. Please use it in a trusted network environment.
- The plugin runs with the current DSH process permissions. It is recommended to check its source code and license before installation. This project uses the MIT license.
- The plugin includes built-in bypass rules for the blocking method in DSH 0.1.x. If the official behavior changes, you need to supplement rules via
bypassRulesyourself.
Conclusion¶
dsh-lan-proxy solves a very specific problem: making the DSH Web UI accessible within the local area network, while handling authentication, protocol, and directory selection nuances in one go, without introducing an extra process. If you have a need to use DSH remotely, you can try it directly.
- Community Directory Page: https://www.skillhub.cn/plugins/liveqte/dsh-lan-proxy
- GitHub Repository: https://github.com/liveqte/dsh-lan-proxy